More settings implementation
This commit is contained in:
+17
-7
@@ -12,6 +12,7 @@ module.exports = [
|
||||
"defaultValue": "Options"
|
||||
},
|
||||
{
|
||||
"id": "time_mg_toggle",
|
||||
"type": "toggle",
|
||||
"messageKey": "CLAY_SHOW_TIME_MG",
|
||||
"defaultValue": false,
|
||||
@@ -30,13 +31,15 @@ module.exports = [
|
||||
{
|
||||
"id": "custom_colors_toggle",
|
||||
"type": "toggle",
|
||||
"messageKey": "PRIV_CUSTOM_COLORS_TOGGLE",
|
||||
"defaultValue": false,
|
||||
"label": "Use custom colors"
|
||||
},
|
||||
{
|
||||
"id": "color_preset_selector",
|
||||
"type": "select",
|
||||
"defaultValue": "Standard",
|
||||
"messageKey": "PRIV_COLOR_PRESET_TOGGLE",
|
||||
"defaultValue": "civic_standard",
|
||||
"label": "Color Preset",
|
||||
"options": [
|
||||
{
|
||||
@@ -52,10 +55,9 @@ module.exports = [
|
||||
{
|
||||
"id": "custom_color_led",
|
||||
"type": "color",
|
||||
"capabilities": ["PLATFORM_EMERY"],
|
||||
"messageKey": "CLAY_LED_COLOR",
|
||||
"defaultValue": "0000ff",
|
||||
"label": "LED color",
|
||||
"defaultValue": "ffffff",
|
||||
"label": "Backlight color (Time 2)",
|
||||
"sunlight": false,
|
||||
},
|
||||
{
|
||||
@@ -67,11 +69,19 @@ module.exports = [
|
||||
"sunlight": false,
|
||||
},
|
||||
{
|
||||
"id": "custom_color_mg",
|
||||
"id": "custom_color_mg_bars",
|
||||
"type": "color",
|
||||
"messageKey": "CLAY_MG_COLOR",
|
||||
"messageKey": "CLAY_BAR_MG_COLOR",
|
||||
"defaultValue": "aaaaaa",
|
||||
"label": "Midground color",
|
||||
"label": "Bar midground color",
|
||||
"sunlight": false,
|
||||
},
|
||||
{
|
||||
"id": "custom_color_mg_time",
|
||||
"type": "color",
|
||||
"messageKey": "CLAY_TIME_MG_COLOR",
|
||||
"defaultValue": "555555",
|
||||
"label": "Time segment midground color",
|
||||
"sunlight": false,
|
||||
},
|
||||
{
|
||||
|
||||
+17
-10
@@ -4,34 +4,41 @@ module.exports = function (minified) {
|
||||
var $ = minified.$;
|
||||
var HTML = minified.HTML;
|
||||
|
||||
// TODO set LED color (only on emery)
|
||||
function setColorsToPreset() {
|
||||
selectedPreset = clayConfig.getItemById('color_preset_selector').get()
|
||||
var selectedPreset = clayConfig.getItemById('color_preset_selector').get();
|
||||
switch (selectedPreset) {
|
||||
case 'civic_si':
|
||||
clayConfig.getItemById('custom_color_bg').set('ff0000');
|
||||
clayConfig.getItemById('custom_color_mg').set('aaaaaa');
|
||||
clayConfig.getItemById('custom_color_fg').set('ffffff');
|
||||
clayConfig.getItemById('custom_color_led').set('ff0000');
|
||||
clayConfig.getItemById('custom_color_bg').set('000000');
|
||||
clayConfig.getItemById('custom_color_mg_bars').set('555555');
|
||||
clayConfig.getItemById('custom_color_mg_time').set('555555');
|
||||
clayConfig.getItemById('custom_color_fg').set('ff0000');
|
||||
break
|
||||
default:
|
||||
clayConfig.getItemById('custom_color_led').set('ffffff');
|
||||
clayConfig.getItemById('custom_color_bg').set('0000ff');
|
||||
clayConfig.getItemById('custom_color_mg').set('aaaaaa');
|
||||
clayConfig.getItemById('custom_color_mg_bars').set('555555');
|
||||
clayConfig.getItemById('custom_color_mg_time').set('555555');
|
||||
clayConfig.getItemById('custom_color_fg').set('ffffff');
|
||||
}
|
||||
}
|
||||
|
||||
// TODO show/hide LED color selector (only on emery)
|
||||
function toggleCustomColors() {
|
||||
setColorsToPreset();
|
||||
if (this.get()) {
|
||||
clayConfig.getItemById('color_preset_selector').hide();
|
||||
clayConfig.getItemById('custom_color_led').show();
|
||||
clayConfig.getItemById('custom_color_bg').show();
|
||||
clayConfig.getItemById('custom_color_mg').show();
|
||||
clayConfig.getItemById('custom_color_mg_bars').show();
|
||||
clayConfig.getItemById('custom_color_mg_time').show();
|
||||
clayConfig.getItemById('custom_color_fg').show();
|
||||
} else {
|
||||
setColorsToPreset();
|
||||
clayConfig.getItemById('color_preset_selector').show();
|
||||
clayConfig.getItemById('custom_color_led').hide();
|
||||
clayConfig.getItemById('custom_color_bg').hide();
|
||||
clayConfig.getItemById('custom_color_mg').hide();
|
||||
clayConfig.getItemById('custom_color_mg_bars').hide();
|
||||
clayConfig.getItemById('custom_color_mg_time').hide();
|
||||
clayConfig.getItemById('custom_color_fg').hide();
|
||||
}
|
||||
}
|
||||
@@ -41,6 +48,6 @@ module.exports = function (minified) {
|
||||
toggleCustomColors.call(customColorsToggle);
|
||||
customColorsToggle.on('change', toggleCustomColors);
|
||||
|
||||
clayConfig.getItemById('color_preset_selector').on('change', setColorsToPreset());
|
||||
clayConfig.getItemById('color_preset_selector').on('change', setColorsToPreset);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user