aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2020-01-12 04:00:41 +0200
committerHenry Jameson <me@hjkos.com>2020-01-12 04:00:41 +0200
commita9a1fc37f546840f3d0fbaed493b131cb9c60669 (patch)
tree928d35076d456c4ca4eca796e6bcffb41cec162d /src
parentf31ed7e5a8a9248886837311d7407b01164724c1 (diff)
fixes, cleanup
Diffstat (limited to 'src')
-rw-r--r--src/components/style_switcher/style_switcher.js13
-rw-r--r--src/services/style_setter/style_setter.js15
2 files changed, 17 insertions, 11 deletions
diff --git a/src/components/style_switcher/style_switcher.js b/src/components/style_switcher/style_switcher.js
index f751260a..4749d3f7 100644
--- a/src/components/style_switcher/style_switcher.js
+++ b/src/components/style_switcher/style_switcher.js
@@ -1,15 +1,20 @@
-import { rgb2hex, hex2rgb, getContrastRatio, getContrastRatioLayers, alphaBlend } from '../../services/color_convert/color_convert.js'
import { set, delete as del } from 'vue'
-import { merge } from 'lodash'
+import {
+ rgb2hex,
+ hex2rgb,
+ getContrastRatio,
+ getContrastRatioLayers,
+ alphaBlend
+} from '../../services/color_convert/color_convert.js'
import {
generateColors,
generateShadows,
generateRadii,
generateFonts,
composePreset,
- getThemes,
- CURRENT_VERSION
+ getThemes
} from '../../services/style_setter/style_setter.js'
+import { CURRENT_VERSION } from '../../services/theme_data/theme_data.service.js'
import ColorInput from '../color_input/color_input.vue'
import RangeInput from '../range_input/range_input.vue'
import OpacityInput from '../opacity_input/opacity_input.vue'
diff --git a/src/services/style_setter/style_setter.js b/src/services/style_setter/style_setter.js
index 46b08628..516fb5f6 100644
--- a/src/services/style_setter/style_setter.js
+++ b/src/services/style_setter/style_setter.js
@@ -114,7 +114,7 @@ const getCssShadowFilter = (input) => {
.join(' ')
}
-const generateColors = (themeData) => {
+export const generateColors = (themeData) => {
const rawOpacity = Object.assign({
panel: 1,
btn: 1,
@@ -182,6 +182,7 @@ const generateColors = (themeData) => {
}
if (k === 'badge') {
colors['badgeNotification'].a = v
+ return
}
if (colors[k]) {
colors[k].a = v
@@ -211,7 +212,7 @@ const generateColors = (themeData) => {
}
}
-const generateRadii = (input) => {
+export const generateRadii = (input) => {
let inputRadii = input.radii || {}
// v1 -> v2
if (typeof input.btnRadius !== 'undefined') {
@@ -244,7 +245,7 @@ const generateRadii = (input) => {
}
}
-const generateFonts = (input) => {
+export const generateFonts = (input) => {
const fonts = Object.entries(input.fonts || {}).filter(([k, v]) => v).reduce((acc, [k, v]) => {
acc[k] = Object.entries(v).filter(([k, v]) => v).reduce((acc, [k, v]) => {
acc[k] = v
@@ -279,7 +280,7 @@ const generateFonts = (input) => {
}
}
-const generateShadows = (input) => {
+export const generateShadows = (input) => {
const border = (top, shadow) => ({
x: 0,
y: top ? 1 : -1,
@@ -376,7 +377,7 @@ const generateShadows = (input) => {
}
}
-const composePreset = (colors, radii, shadows, fonts) => {
+export const composePreset = (colors, radii, shadows, fonts) => {
return {
rules: {
...shadows.rules,
@@ -393,14 +394,14 @@ const composePreset = (colors, radii, shadows, fonts) => {
}
}
-const generatePreset = (input) => composePreset(
+export const generatePreset = (input) => composePreset(
generateColors(input),
generateRadii(input),
generateShadows(input),
generateFonts(input)
)
-const getThemes = () => {
+export const getThemes = () => {
return window.fetch('/static/styles.json')
.then((data) => data.json())
.then((themes) => {