Add initial configuration
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
module.exports = [
|
||||
{
|
||||
"type": "heading",
|
||||
"defaultValue": "Civic Segments | Settings"
|
||||
},
|
||||
{
|
||||
"type": "section",
|
||||
"items": [
|
||||
{
|
||||
"type": "heading",
|
||||
"size": 3,
|
||||
"defaultValue": "Options"
|
||||
},
|
||||
{
|
||||
"type": "toggle",
|
||||
"messageKey": "CLAY_SHOW_TIME_MG",
|
||||
"defaultValue": false,
|
||||
"label": "Show time segments midground"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "section",
|
||||
"items": [
|
||||
{
|
||||
"type": "heading",
|
||||
"size": 3,
|
||||
"defaultValue": "Colors"
|
||||
},
|
||||
{
|
||||
"id": "custom_colors_toggle",
|
||||
"type": "toggle",
|
||||
"defaultValue": false,
|
||||
"label": "Use custom colors"
|
||||
},
|
||||
{
|
||||
"id": "color_preset_selector",
|
||||
"type": "select",
|
||||
"defaultValue": "Standard",
|
||||
"label": "Color Preset",
|
||||
"options": [
|
||||
{
|
||||
"label": "Civic Standard",
|
||||
"value": "civic_standard"
|
||||
},
|
||||
{
|
||||
"label": "Civic Si",
|
||||
"value": "civic_si"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "custom_color_led",
|
||||
"type": "color",
|
||||
"capabilities": ["PLATFORM_EMERY"],
|
||||
"messageKey": "CLAY_LED_COLOR",
|
||||
"defaultValue": "0000ff",
|
||||
"label": "LED color",
|
||||
"sunlight": false,
|
||||
},
|
||||
{
|
||||
"id": "custom_color_bg",
|
||||
"type": "color",
|
||||
"messageKey": "CLAY_BG_COLOR",
|
||||
"defaultValue": "0000ff",
|
||||
"label": "Background color",
|
||||
"sunlight": false,
|
||||
},
|
||||
{
|
||||
"id": "custom_color_mg",
|
||||
"type": "color",
|
||||
"messageKey": "CLAY_MG_COLOR",
|
||||
"defaultValue": "aaaaaa",
|
||||
"label": "Midground color",
|
||||
"sunlight": false,
|
||||
},
|
||||
{
|
||||
"id": "custom_color_fg",
|
||||
"type": "color",
|
||||
"messageKey": "CLAY_FG_COLOR",
|
||||
"defaultValue": "ffffff",
|
||||
"label": "Foreground color",
|
||||
"sunlight": false,
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "submit",
|
||||
"defaultValue": "Save Settings"
|
||||
}
|
||||
];
|
||||
@@ -0,0 +1,46 @@
|
||||
module.exports = function (minified) {
|
||||
var clayConfig = this;
|
||||
var _ = minified._;
|
||||
var $ = minified.$;
|
||||
var HTML = minified.HTML;
|
||||
|
||||
// TODO set LED color (only on emery)
|
||||
function setColorsToPreset() {
|
||||
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');
|
||||
break
|
||||
default:
|
||||
clayConfig.getItemById('custom_color_bg').set('0000ff');
|
||||
clayConfig.getItemById('custom_color_mg').set('aaaaaa');
|
||||
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_bg').show();
|
||||
clayConfig.getItemById('custom_color_mg').show();
|
||||
clayConfig.getItemById('custom_color_fg').show();
|
||||
} else {
|
||||
clayConfig.getItemById('color_preset_selector').show();
|
||||
clayConfig.getItemById('custom_color_bg').hide();
|
||||
clayConfig.getItemById('custom_color_mg').hide();
|
||||
clayConfig.getItemById('custom_color_fg').hide();
|
||||
}
|
||||
}
|
||||
|
||||
clayConfig.on(clayConfig.EVENTS.AFTER_BUILD, function () {
|
||||
var customColorsToggle = clayConfig.getItemById('custom_colors_toggle');
|
||||
toggleCustomColors.call(customColorsToggle);
|
||||
customColorsToggle.on('change', toggleCustomColors);
|
||||
|
||||
clayConfig.getItemById('color_preset_selector').on('change', setColorsToPreset());
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
var Clay = require('@rebble/clay');
|
||||
var clayConfig = require('./config');
|
||||
var customClay = require('./customClay');
|
||||
new Clay(clayConfig, customClay);
|
||||
|
||||
Pebble.addEventListener("ready", function () {
|
||||
Pebble.sendAppMessage({ PKJS_READY: 1 });
|
||||
});
|
||||
Reference in New Issue
Block a user