5 kyu

Convert A Hex String To RGB

6,181 of 15,971Krxtopher

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 Trained25748
Total Skips3544
Total Code Submissions32552
Total Times Completed15971
JavaScript Completions6181
CoffeeScript Completions59
Swift Completions432
Kotlin Completions777
Python Completions5346
Ruby Completions289
C Completions823
Java Completions1510
Dart Completions480
Scala Completions32
TypeScript Completions359
Total Stars343
% of votes with a positive feedback rating90% of 1401
Total "Very Satisfied" Votes1154
Total "Somewhat Satisfied" Votes224
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