Skip to content

Commit

Permalink
✨ #RRGGBBAA support
Browse files Browse the repository at this point in the history
  • Loading branch information
noeldelgado committed Feb 21, 2020
1 parent 90cff5a commit a80b545
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
13 changes: 11 additions & 2 deletions src/css/lib/style.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
html,
body { height: 100%; }
html {
height: 100%;
/**
* CSS gradient checkerboard pattern
* https://stackoverflow.com/questions/35361986/css-gradient-checkerboard-pattern
*/
background-image: linear-gradient(45deg, #808080 25%, transparent 25%), linear-gradient(-45deg, #808080 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #808080 75%), linear-gradient(-45deg, transparent 75%, #808080 75%);
background-size: 20px 20px;
background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

body {
min-height: 100%;
line-height: 1;
font-weight: 800;

Expand Down
11 changes: 6 additions & 5 deletions src/js/lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ export default class App {
theme: 'nano',
position: 'right',
components: {
hue: true
hue: true,
opacity: true
}
});
}
Expand Down Expand Up @@ -230,18 +231,18 @@ export default class App {
const { preventHistoryUpdate, preventElementUpdate } = params;

app.color = Color(color);
app.pickr.setColor(color);

let hex = app.color.hex();
let hex = app.pickr.getColor().toHEXA().toString();
let rgb = app.color.rgb().string();
let hsl = app.color.hsl().round().string();
let hwb = app.color.hwb().round().string();
let hsl = app.color.hsl().string(0);
let hwb = app.color.hwb().string(0);
let [ r, g, b] = app.color.unitArray();

let isLight = app.color.isLight();
let textColor = app.color.mix(Color(isLight ? '#000' : '#fff'), 0.8);
let borderColor = app.color.mix(Color(isLight ? '#000' : '#fff'), 0.2);

app.pickr.setColor(hex);

if (preventElementUpdate !== app.ui.hexInput.element) {
app.ui.hexInput.setValue(hex);
Expand Down

0 comments on commit a80b545

Please sign in to comment.