aboutsummaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
Diffstat (limited to 'src/services')
-rw-r--r--src/services/style_setter/style_setter.js15
-rw-r--r--src/services/theme_data/theme_data.service.js15
2 files changed, 16 insertions, 14 deletions
diff --git a/src/services/style_setter/style_setter.js b/src/services/style_setter/style_setter.js
index 516fb5f6..e11516c0 100644
--- a/src/services/style_setter/style_setter.js
+++ b/src/services/style_setter/style_setter.js
@@ -1,7 +1,7 @@
import { times } from 'lodash'
import { convert } from 'chromatism'
import { rgb2hex, hex2rgb, rgba2css, getCssColor } from '../color_convert/color_convert.js'
-import { getColors } from '../theme_data/theme_data.service.js'
+import { getColors, DEFAULT_OPACITY } from '../theme_data/theme_data.service.js'
// While this is not used anymore right now, I left it in if we want to do custom
// styles that aren't just colors, so user can pick from a few different distinct
@@ -115,18 +115,7 @@ const getCssShadowFilter = (input) => {
}
export const generateColors = (themeData) => {
- const rawOpacity = Object.assign({
- panel: 1,
- btn: 1,
- border: 1,
- bg: 1,
- badge: 1,
- text: 1,
- alert: 0.5,
- input: 0.5,
- faint: 0.5,
- underlay: 0.15
- }, Object.entries(themeData.opacity || {}).reduce((acc, [k, v]) => {
+ const rawOpacity = Object.assign({ ...DEFAULT_OPACITY }, Object.entries(themeData.opacity || {}).reduce((acc, [k, v]) => {
if (typeof v !== 'undefined') {
acc[k] = v
}
diff --git a/src/services/theme_data/theme_data.service.js b/src/services/theme_data/theme_data.service.js
index 1117ab05..297d0223 100644
--- a/src/services/theme_data/theme_data.service.js
+++ b/src/services/theme_data/theme_data.service.js
@@ -23,6 +23,19 @@ export const LAYERS = {
alertPanel: 'panel'
}
+export const DEFAULT_OPACITY = {
+ panel: 1,
+ btn: 1,
+ border: 1,
+ bg: 1,
+ badge: 1,
+ text: 1,
+ alert: 0.5,
+ input: 0.5,
+ faint: 0.5,
+ underlay: 0.15
+}
+
export const SLOT_INHERITANCE = {
bg: null,
fg: null,
@@ -289,7 +302,7 @@ export const getColors = (sourceColors, sourceOpacity, mod) => SLOT_ORDERED.redu
if (value.textColor === 'bw') {
return {
...acc,
- [key]: contrastRatio(bg)
+ [key]: contrastRatio(bg).rgb
}
} else {
return {