masakudamatsu / color-picker Goto Github PK
View Code? Open in Web Editor NEWA web app to show colors of a chosen luminance level
A web app to show colors of a chosen luminance level
To obtain the hue value in HSLuv
hsl to rgb
luminance to rgb in grey scale
See how https://www.w3schools.com/colors/colors_converter.asp works
Why?
Use either
See https://www.evernote.com/l/AFOtgadxEEJBr4LndvsznouTCvEfYLySFPI
See this CSS-Tricks article for JavaScript code to convert RGB values into HSL values.
Find a way to render both RGB and HSL values within (or beneath) the color swashes.
Show color name and swash.
User can select one by click/tap
For each hue, three versions
Red 350, 0, 10
Orange/brown 20, 30, 40
Yellow 60
Yellow-green 90
Green 120
Green-cyan 150
Cyan / Aqua / Teal 180
Blue-cyan 210
Blue 240
Indigo(?) 270
Violet / Purple / Magenta 300
Shocking pink 320, 330, 340
Each swash is bordered with black/white if user selected luminance is lighter/darker than mid-grey.
Background is the user selected luminance in grayscale.
See my Evernote note: HTML forms 207: Range Input (Slider).
It's more illustrative if we change the luminance level continuously, rather than entering a value in a discrete fashion.
Set the red luminance level 0.9.
Swash
componentThen calculate the RGB values for a given luminance level that the user enters.
LuminanceSetter
component executes the setLuminance()
method in App.js
with the user-entered value as its argument.App.js
then updates the luminance level as its state
, and pass it to the Swash
component.Swash
component calls the generateColor() function from ColorGenerator.js
, to calculate the RGB values as an object.Use this RGB value to render a swash of red shades.
Swash
component updates the text and the background-color
property based on the calculated RGB value.background-color: transparent
with no text.The backspace key won't delete the entered number if there only remains one digit.
luminance (1 to 21)
hex
rgb
hsl
Either text field
To feedback the user action consequence.
Make the entire page background rendered in user’s choice.
For each hue (red, yellow, green, cyan, blue, purple):
ColorGenerator.js
, create a function that produces RGB values from the luminance levelSwash
component, use the conditional flow to switch the ColorGenerator method to obtain RGB valuesApp.js
, add the Swash component instances with each hue's luminance as an attribute.To render color swashes with color code values
Background color is black/white if the user selected luminance is brighter/darker than mid-grey.
Pick luminance value for user input 1
Pick hue values for user input 2
Get HSLuv values for the range of saturation
3 (hue) x 20 (saturation)
Use hsluv.js as rgb values as inputs
Keywords
Use this CodePen as a template.
To follow up Issue #10
See
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.