feat: added operator color to wallpaper engine
This commit is contained in:
@@ -83,6 +83,7 @@ const process = ({
|
||||
data: ProjectJSON
|
||||
template: TemplateYAML
|
||||
}) => {
|
||||
const { r, g, b } = getRGBfromHEXColor(operators[name].color)
|
||||
return {
|
||||
...data,
|
||||
description: template.description,
|
||||
@@ -92,11 +93,29 @@ const process = ({
|
||||
localization: template.localization,
|
||||
properties: {
|
||||
...getProperties(template),
|
||||
schemecolor: {
|
||||
order: 0,
|
||||
text: 'ui_browse_properties_scheme_color',
|
||||
type: 'color',
|
||||
value: `${r / 255} ${g / 255} ${b / 255}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
} as ProjectJSON
|
||||
}
|
||||
|
||||
const getRGBfromHEXColor = (hex: string) => {
|
||||
const hexNo = parseInt(hex.replace('#', ''), 16)
|
||||
const r = (hexNo >> 16) & 255
|
||||
const g = (hexNo >> 8) & 255
|
||||
const b = hexNo & 255
|
||||
return {
|
||||
r,
|
||||
g,
|
||||
b,
|
||||
}
|
||||
}
|
||||
|
||||
const getProperties = (template: TemplateYAML) => {
|
||||
const properties = template.properties
|
||||
const output = {} as {
|
||||
|
||||
@@ -7,7 +7,7 @@ export type Assets = {
|
||||
|
||||
export interface Property {
|
||||
text: string
|
||||
type?: 'bool' | 'file' | 'slider' | 'combo' | 'textinput'
|
||||
type?: 'bool' | 'file' | 'slider' | 'combo' | 'textinput' | 'color'
|
||||
value?: boolean | string
|
||||
condition?: string
|
||||
fraction?: boolean
|
||||
@@ -20,7 +20,7 @@ export interface Property {
|
||||
}
|
||||
|
||||
export interface ProjectJSONProperty extends Property {
|
||||
index: number
|
||||
index?: number
|
||||
order: number
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user