oh-colorpicker: Replace defaultColor option with an actual default color (#2270)

Remove the defaultColor option.
Instead use RGB(0,0,0) black as default color if the Item state holds no
valid color, so that the color picker is accessible.

---------

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
pull/2263/head^2
Florian Hotze 2024-01-14 14:50:56 +01:00 committed by GitHub
parent 4d4aea4a69
commit f912de509c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 2 additions and 30 deletions

View File

@ -83,11 +83,6 @@ Display a color picker in a card
<PropOption value="initial-current-colors" label="Initial current colors" />
</PropOptions>
</PropBlock>
<PropBlock type="TEXT" name="defaultColor" label="Default Color">
<PropDescription>
Color (e.g. <code>[0,0,0]</code> for black) to use for the color picker if state does not contain a color (e.g. because it is <code>NULL</code>)
</PropDescription>
</PropBlock>
</PropGroup>
</div>

View File

@ -93,11 +93,6 @@ A cell expanding to a color picker
<PropOption value="initial-current-colors" label="Initial current colors" />
</PropOptions>
</PropBlock>
<PropBlock type="TEXT" name="defaultColor" label="Default Color">
<PropDescription>
Color (e.g. <code>[0,0,0]</code> for black) to use for the color picker if state does not contain a color (e.g. because it is <code>NULL</code>)
</PropDescription>
</PropBlock>
</PropGroup>
</div>

View File

@ -88,11 +88,6 @@ Display a color picker in a list
<PropOption value="initial-current-colors" label="Initial current colors" />
</PropOptions>
</PropBlock>
<PropBlock type="TEXT" name="defaultColor" label="Default Color">
<PropDescription>
Color (e.g. <code>[0,0,0]</code> for black) to use for the color picker if state does not contain a color (e.g. because it is <code>NULL</code>)
</PropDescription>
</PropBlock>
</PropGroup>
</div>

View File

@ -51,11 +51,6 @@ Control to pick a color
<PropOption value="initial-current-colors" label="Initial current colors" />
</PropOptions>
</PropBlock>
<PropBlock type="TEXT" name="defaultColor" label="Default Color">
<PropDescription>
Color (e.g. <code>[0,0,0]</code> for black) to use for the color picker if state does not contain a color (e.g. because it is <code>NULL</code>)
</PropDescription>
</PropBlock>
</PropGroup>
</div>

View File

@ -14,6 +14,5 @@ export default () => [
{ value: 'palette', label: 'Palette' },
{ value: 'current-color', label: 'Current color' },
{ value: 'initial-current-colors', label: 'Initial current colors' }
], true, true),
pt('defaultColor', 'Default Color', 'Color (e.g. <code>[0,0,0]</code> for black) to use for the color picker if state does not contain a color (e.g. because it is <code>NULL</code>)')
], true, true)
]

View File

@ -51,14 +51,7 @@ export default {
color[2] = color[2] / 100
return color
}
if (this.config.defaultColor) {
try {
return JSON.parse(this.config.defaultColor)
} catch {
return null
}
}
return null
return [0, 0, 0]
}
},
watch: {