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

Stats:

CreatedNov 12, 2013
PublishedNov 12, 2013
Warriors Trained26011
Total Skips3572
Total Code Submissions32876
Total Times Completed16145
JavaScript Completions6222
CoffeeScript Completions59
Swift Completions433
Kotlin Completions788
Python Completions5412
Ruby Completions294
C Completions835
Java Completions1525
Dart Completions495
Scala Completions33
TypeScript Completions376
Total Stars345
% of votes with a positive feedback rating90% of 1415
Total "Very Satisfied" Votes1166
Total "Somewhat Satisfied" Votes226
Total "Not Satisfied" Votes23
Ad
Contributors
  • Krxtopher Avatar
  • jhoffner Avatar
  • mimshwright Avatar
  • anter69 Avatar
  • JDeBolt Avatar
  • gcm Avatar
  • kazk Avatar
  • Blind4Basics Avatar
  • rowcased Avatar
  • kdmatrosov Avatar
  • cveneziani Avatar
  • monadius Avatar
  • hobovsky Avatar
  • albertogcmr Avatar
  • Etoneja Avatar
  • zLuki Avatar
  • miscsb Avatar
  • jdold07 Avatar
  • 4500zenja1 Avatar
  • KayleighWasTaken Avatar
  • HartlIKS Avatar
Ad