From 04cdcf27c5b3994df911050adedf862f7628c1b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D1=80=D0=B0=D1=81=D0=B8=D0=BC=D0=B8=D1=80=20=D0=91?= =?UTF-8?q?=D0=B5=D1=80=D0=BE=D0=B2?= Date: Fri, 7 Jul 2023 17:38:19 +0300 Subject: [PATCH] Hint for RGB color calculation --- src/hello/print/fmt.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hello/print/fmt.md b/src/hello/print/fmt.md index c3c78f6b16..b6f6760611 100644 --- a/src/hello/print/fmt.md +++ b/src/hello/print/fmt.md @@ -78,8 +78,11 @@ RGB (0, 3, 254) 0x0003FE RGB (0, 0, 0) 0x000000 ``` -Two hints if you get stuck: +Three hints if you get stuck: +* The formula for calculating a color in the RGB color space is: +`RGB = (R*65536)+(G*256)+B , (when R is RED, G is GREEN and B is BLUE)`. +For more see [RGB color format & calculation][rgb_color]. * You [may need to list each color more than once][named_parameters]. * You can [pad with zeros to a width of 2][fmt_width] with `:0>2`. @@ -87,6 +90,7 @@ Two hints if you get stuck: [`std::fmt`][fmt] +[rgb_color]: https://www.rapidtables.com/web/color/RGB_Color.html#rgb-format [named_parameters]: https://doc.rust-lang.org/std/fmt/#named-parameters [deadbeef]: https://en.wikipedia.org/wiki/Deadbeef#Magic_debug_values [fmt]: https://doc.rust-lang.org/std/fmt/