🏆 [M💙 Challenge] Hex Triplet Colour Shades ❤💚💙💜💛 | Sololearn: Learn to code for FREE!


🏆 [M💙 Challenge] Hex Triplet Colour Shades ❤💚💙💜💛

Monday Blue 💙 Challenge Series #5 Let's get colourful this week! If you're familiar with the HTML challenges, there are a few quizzes that require you to identify the shade of colour based on the Hex Triplet (#RRGGBB). 💼 TASK Write a program to accept a Hex Triplet (#RRGGBB) and determine whether it represents the colour of the following categories:- "Black" #000000 "White" #FFFFFF "Shade of Grey" Neutral. Equal weightage of all components. "Shade of Red" Red dominant* "Shade of Green" Green dominant* "Shade of Blue" Blue dominant* * pure shades with equal weightage of other components. "Shade of Yellow" Red-Green dominant with relatively higher weightage than Blue. "Shade of Purple" Red-Blue dominant with relatively higher weightage than Green. "Shade of Cyan" Green-Blue dominant with relatively higher weightage than Red. 🔧 TEST CASE #252525 ➡ "Shade of Grey" #AA3333 ➡ "Shade of Red" #11BB11 ➡ "Shade of Green" #CCCCFF ➡ "Shade of Blue" #FACE00 ➡ "Shade of Yellow" #BB33AA ➡ "Shade of Purple" #22DD33 ➡ "Shade of Cyan" ❤ BONUS Creative and clear-cut approach is encouraged. 👍 SPECIAL MENTION https://code.sololearn.com/W0vQm8LhnxdQ/?ref=app Happy Coding!!! 😁💻

10/23/2017 2:57:39 AM

Zephyr Koo

14 Answers

New Answer


My try: https://code.sololearn.com/WfjR4Jw0H0Ch/?ref=app


OMG another fast and furious submission by Sir Krishna again!!! 🔥😱


My try...I disagree with some of the tests https://code.sololearn.com/cSfG3KJLbmdw/?ref=app


marking thread




Thanks everyone for your participation! I picked the fastest submission by Sir Krishna as there are only a few variation algorithms this time. Besides, I've added a special mention for the awesome visualization with EJS by Calviղ in the description as well. Anyway hope you all enjoy and let's move on to the next challenge! ❤ https://www.sololearn.com/Discuss/808616/?ref=app


Here's my own C# implementation for anyone of you who's interested. 😉 https://code.sololearn.com/cdqQxYAzEfac/?ref=app


@Calviղ Yup you're right! I'm having trouble to determine the correct name for it before this. For example Purple can be replaced with Magenta but the former sounds more natural to us. Thanks for your correction! 😄


@Yerucham Would you mind to elaborate it and the usage of magic number 21? 😉


My try https://code.sololearn.com/W0vQm8LhnxdQ/?ref=app


Another good challenge to try, by @Zephyr 👍🏼🤖 Btw should R-G dominance color be yellow color, not brown? I think Brown should belong to shade of Red?


My try in Java : https://code.sololearn.com/cJ52gPSMD46C/?ref=app


HERES A NEW CHALLENGE CHECK IT AND TRY IF YOU WANT https://www.sololearn.com/discuss/793924/?ref=app