-
-
Notifications
You must be signed in to change notification settings - Fork 44k
Challenge (Adjust the Tone of a Color): Use computed styles for test or fix regex #45859
Copy link
Copy link
Closed
Labels
help wantedOpen for all. You do not need permission to work on these.Open for all. You do not need permission to work on these.scope: curriculumLessons, Challenges, Projects and other Curricular Content in curriculum directory.Lessons, Challenges, Projects and other Curricular Content in curriculum directory.
Description
Instead of using a regex maybe we should just check the computed styles?
background-color: hsl(180, 80%, 25%);
// $0 is the nav element
getComputedStyle($0).backgroundColor
'rgb(13, 115, 115)'
I realize doing so will technically allow users to pass the test without using the hsl() function, but I doubt people will convert the HSL value to hex or RGB and submit that.
Or, we can trim the code of whitespace and/or allow for spaces in the regex.
Forum thread: https://forum.freecodecamp.org/t/about-your-answer-checking-algorithm/507093
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
help wantedOpen for all. You do not need permission to work on these.Open for all. You do not need permission to work on these.scope: curriculumLessons, Challenges, Projects and other Curricular Content in curriculum directory.Lessons, Challenges, Projects and other Curricular Content in curriculum directory.