diff options
| author | shpuld <shp@cock.li> | 2017-11-20 22:45:09 +0200 |
|---|---|---|
| committer | shpuld <shp@cock.li> | 2017-11-20 22:45:09 +0200 |
| commit | f6b2f6eaeed78ba4e4a6d12189b7d96474e54915 (patch) | |
| tree | a2f9393bf84acd45e885e086faf5cc7fd70b2669 /src/components/style_switcher/style_switcher.js | |
| parent | 80203636803c3035a46d0d82c7778e4aff8d2612 (diff) | |
Fix usercard from breaking with certain colors, clean up code structure a bit.
Diffstat (limited to 'src/components/style_switcher/style_switcher.js')
| -rw-r--r-- | src/components/style_switcher/style_switcher.js | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/components/style_switcher/style_switcher.js b/src/components/style_switcher/style_switcher.js index b1359d13..a762f914 100644 --- a/src/components/style_switcher/style_switcher.js +++ b/src/components/style_switcher/style_switcher.js @@ -1,3 +1,5 @@ +import { rgbstr2hex } from '../../services/color_convert/color_convert.js' + export default { data () { return { @@ -19,13 +21,6 @@ export default { }) }, mounted () { - const rgbstr2hex = (rgb) => { - if (rgb[0] === '#') { - return rgb - } - rgb = rgb.match(/\d+/g) - return `#${((Number(rgb[0]) << 16) + (Number(rgb[1]) << 8) + Number(rgb[2])).toString(16)}` - } this.bgColorLocal = rgbstr2hex(this.$store.state.config.colors['base00']) this.fgColorLocal = rgbstr2hex(this.$store.state.config.colors['base02']) this.textColorLocal = rgbstr2hex(this.$store.state.config.colors['base05']) |
