mirror of
https://git.wetfence.xyz/RandyTheSilly/Civic-Segments.git
synced 2026-09-05 18:17:13 -04:00
Allow using system backlight color
This commit is contained in:
+9
-1
@@ -89,12 +89,20 @@ module.exports = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "custom_led_toggle",
|
||||
"type": "toggle",
|
||||
"messageKey": "CLAY_USE_CUSTOM_LED",
|
||||
"defaultValue": false,
|
||||
"label": "Use custom backlight color",
|
||||
"description": "Enable to override your system-wide setting.",
|
||||
},
|
||||
{
|
||||
"id": "custom_color_led",
|
||||
"type": "color",
|
||||
"messageKey": "CLAY_LED_COLOR",
|
||||
"defaultValue": "ffffff",
|
||||
"label": "Backlight color (Time 2)",
|
||||
"label": "Backlight color",
|
||||
"sunlight": false,
|
||||
},
|
||||
{
|
||||
|
||||
+18
-1
@@ -4,11 +4,21 @@ module.exports = function (minified) {
|
||||
var $ = minified.$;
|
||||
var HTML = minified.HTML;
|
||||
|
||||
function toggleCustomBacklight() {
|
||||
if (this.get()) {
|
||||
clayConfig.getItemById('custom_color_led').enable();
|
||||
} else {
|
||||
clayConfig.getItemById('custom_color_led').disable();
|
||||
}
|
||||
}
|
||||
|
||||
function setColorsToPreset() {
|
||||
var selectedPreset = clayConfig.getItemById('color_preset_selector').get();
|
||||
switch (selectedPreset) {
|
||||
case 'civic_si':
|
||||
clayConfig.getItemById('custom_led_toggle').set(true); // override system with red backlight
|
||||
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_cool_bars').set('0000aa');
|
||||
@@ -18,7 +28,8 @@ module.exports = function (minified) {
|
||||
clayConfig.getItemById('custom_color_warning').set('ffaa00');
|
||||
break
|
||||
default:
|
||||
clayConfig.getItemById('custom_color_led').set('ffffff');
|
||||
clayConfig.getItemById('custom_led_toggle').set(false); // use system LED color
|
||||
|
||||
clayConfig.getItemById('custom_color_bg').set('0000ff');
|
||||
clayConfig.getItemById('custom_color_mg_bars').set('555555');
|
||||
clayConfig.getItemById('custom_color_cool_bars').set('0000aa');
|
||||
@@ -32,6 +43,7 @@ module.exports = function (minified) {
|
||||
function toggleCustomColors() {
|
||||
if (this.get()) {
|
||||
clayConfig.getItemById('color_preset_selector').hide();
|
||||
clayConfig.getItemById('custom_led_toggle').show();
|
||||
clayConfig.getItemById('custom_color_led').show();
|
||||
clayConfig.getItemById('custom_color_bg').show();
|
||||
clayConfig.getItemById('custom_color_mg_bars').show();
|
||||
@@ -43,6 +55,7 @@ module.exports = function (minified) {
|
||||
} else {
|
||||
setColorsToPreset();
|
||||
clayConfig.getItemById('color_preset_selector').show();
|
||||
clayConfig.getItemById('custom_led_toggle').hide();
|
||||
clayConfig.getItemById('custom_color_led').hide();
|
||||
clayConfig.getItemById('custom_color_bg').hide();
|
||||
clayConfig.getItemById('custom_color_mg_bars').hide();
|
||||
@@ -59,6 +72,10 @@ module.exports = function (minified) {
|
||||
toggleCustomColors.call(customColorsToggle);
|
||||
customColorsToggle.on('change', toggleCustomColors);
|
||||
|
||||
var customBacklightToggle = clayConfig.getItemById('custom_led_toggle');
|
||||
toggleCustomBacklight.call(customBacklightToggle);
|
||||
customBacklightToggle.on('change', toggleCustomBacklight);
|
||||
|
||||
clayConfig.getItemById('color_preset_selector').on('change', setColorsToPreset);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user