Skip to content

Latest commit

 

History

History
14 lines (10 loc) · 595 Bytes

(5 kyu) RGB To Hex Conversion.md

File metadata and controls

14 lines (10 loc) · 595 Bytes

RGB To Hex Conversion (5 kyu)

https://www.codewars.com/kata/rgb-to-hex-conversion/

The rgb() method is incomplete. Complete the method so that passing in RGB decimal values will result in a hexadecimal representation being returned. The valid decimal values for RGB are 0 - 255. Any (r,g,b) argument values that fall out of that range should be rounded to the closest valid value.

The following are examples of expected output values:

rgb(255, 255, 255); // returns FFFFFF
rgb(255, 255, 300); // returns FFFFFF
rgb(0, 0, 0); // returns 000000
rgb(148, 0, 211); // returns 9400D3