Files
GDevelop/newIDE/app/scripts/build-theme-resources.js
Florian Rival e98c96b5a4 Add a new "Modern" dark theme (#3974)
* This theme brings some changes to make the interface more readable to new users (outlined buttons) and a more modern approach (vibrant color, rounded buttons). It's still based on Material Design and similar to other themes, but is a first step toward an improved interface.
2022-06-01 14:36:07 +02:00

55 lines
1.3 KiB
JavaScript

const fs = require('fs');
const style = require('style-dictionary');
const readThemeRegistry = require('./lib/ReadThemeRegistry');
style.registerAction({
name: 'set_theme_class',
do(styleDictionary, config) {
let path = config.files[0].destination;
fs.writeFileSync(
path,
fs
.readFileSync(path)
.toString()
.replace(':root', '.' + config.theme)
);
},
undo() {},
});
const registry = readThemeRegistry();
for (let registration of registry) {
const theme = registration.id;
style
.extend({
source: [
`${__dirname}/../src/UI/Theme/Global/styles.json`, // Global styles
`${__dirname}/../src/UI/Theme/${theme}/theme.json`, // Theme specific overrides
],
platforms: {
css: {
theme,
transformGroup: 'css',
files: [
{
format: 'css/variables',
destination: `${__dirname}/../src/UI/Theme/${theme}/${theme}Variables.css`,
},
],
actions: ['set_theme_class'],
},
js: {
transformGroup: 'js',
files: [
{
format: 'json/flat',
destination: `${__dirname}/../src/UI/Theme/${theme}/${theme}Variables.json`,
},
],
},
},
})
.buildAllPlatforms();
}