5 kyu
Convert A Hex String To RGB
6,222 of 16,145Krxtopher
Description:
When working with color values it can sometimes be useful to extract the individual red, green, and blue (RGB) component values for a color. Implement a function that meets these requirements:
- Accepts a case-insensitive hexadecimal color string as its parameter (ex.
"#FF9933"
or"#ff9933"
) - Returns a Map<String, int> with the structure
{r: 255, g: 153, b: 51}
where r, g, and b range from 0 through 255
Note: your implementation does not need to support the shorthand form of hexadecimal notation (ie "#FFF"
)
Example
"#FF9933" --> {r: 255, g: 153, b: 51}
Parsing
Strings
Algorithms
Similar Kata:
Stats:
Created | Nov 12, 2013 |
Published | Nov 12, 2013 |
Warriors Trained | 26011 |
Total Skips | 3572 |
Total Code Submissions | 32876 |
Total Times Completed | 16145 |
JavaScript Completions | 6222 |
CoffeeScript Completions | 59 |
Swift Completions | 433 |
Kotlin Completions | 788 |
Python Completions | 5412 |
Ruby Completions | 294 |
C Completions | 835 |
Java Completions | 1525 |
Dart Completions | 495 |
Scala Completions | 33 |
TypeScript Completions | 376 |
Total Stars | 345 |
% of votes with a positive feedback rating | 90% of 1415 |
Total "Very Satisfied" Votes | 1166 |
Total "Somewhat Satisfied" Votes | 226 |
Total "Not Satisfied" Votes | 23 |