Merge pull request #79 from ryanalexander/master

This commit is contained in:
Paul Makles 2021-08-15 19:29:42 +01:00 committed by GitHub
commit c99c3ffc35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View file

@ -372,7 +372,7 @@ export function Component(props: Props) {
}
/>
</div>
<span>{x}</span>
<span style={`color: ${getContrastingColour(theme[x])}`}>{x}</span>
<div className={styles.override}>
<div
className={styles.picker}
@ -445,3 +445,12 @@ export const Appearance = connectState(Component, (state) => {
settings: state.settings,
};
});
function getContrastingColour(hex: string){
hex = hex.replace("#", "");
const r = parseInt(hex.substr(0,2),16);
const g = parseInt(hex.substr(2,2),16);
const b = parseInt(hex.substr(4,2),16);
const cc = ((r*299)+(g*587)+(b*114))/1000;
return (cc >= 128) ? 'black' : 'white';
}

View file

@ -296,11 +296,9 @@
margin-bottom: 8px;
text-transform: capitalize;
color: transparent;
background: inherit;
background-clip: text;
-webkit-background-clip: text;
filter: sepia(1) invert(1) contrast(9) grayscale(1);
}
.override {