mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-29 10:20:59 -05:00
Merge pull request #79 from ryanalexander/master
This commit is contained in:
commit
c99c3ffc35
2 changed files with 10 additions and 3 deletions
|
@ -372,7 +372,7 @@ export function Component(props: Props) {
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<span>{x}</span>
|
<span style={`color: ${getContrastingColour(theme[x])}`}>{x}</span>
|
||||||
<div className={styles.override}>
|
<div className={styles.override}>
|
||||||
<div
|
<div
|
||||||
className={styles.picker}
|
className={styles.picker}
|
||||||
|
@ -445,3 +445,12 @@ export const Appearance = connectState(Component, (state) => {
|
||||||
settings: state.settings,
|
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';
|
||||||
|
}
|
||||||
|
|
|
@ -296,11 +296,9 @@
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
|
|
||||||
color: transparent;
|
|
||||||
background: inherit;
|
background: inherit;
|
||||||
background-clip: text;
|
background-clip: text;
|
||||||
-webkit-background-clip: text;
|
-webkit-background-clip: text;
|
||||||
filter: sepia(1) invert(1) contrast(9) grayscale(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.override {
|
.override {
|
||||||
|
|
Loading…
Reference in a new issue