Added experimental themes flag

This commit is contained in:
Mikayla Maki
2022-09-08 15:47:27 -07:00
parent d881320345
commit 2b4db9b16e
12 changed files with 87 additions and 27 deletions
+4 -1
View File
@@ -2,12 +2,13 @@ import * as fs from "fs";
import * as path from "path";
import { tmpdir } from "os";
import app from "./styleTree/app";
import themes, { internalThemes } from "./themes";
import themes, { internalThemes, experimentalThemes } from "./themes";
import snakeCase from "./utils/snakeCase";
import Theme from "./themes/common/theme";
const themeDirectory = `${__dirname}/../../assets/themes`;
const internalDirectory = `${themeDirectory}/internal`;
const experimentsDirectory = `${themeDirectory}/experiments`;
const tempDirectory = fs.mkdtempSync(path.join(tmpdir(), "build-themes"));
// Clear existing themes
@@ -24,6 +25,7 @@ function clearThemes(themeDirectory: string) {
clearThemes(themeDirectory);
clearThemes(internalDirectory);
clearThemes(experimentsDirectory);
function writeThemes(themes: Theme[], outputDirectory: string) {
for (let theme of themes) {
@@ -40,3 +42,4 @@ function writeThemes(themes: Theme[], outputDirectory: string) {
// Write new themes to theme directory
writeThemes(themes, themeDirectory);
writeThemes(internalThemes, internalDirectory);
writeThemes(experimentalThemes, experimentsDirectory);
+6
View File
@@ -8,6 +8,10 @@ export default themes;
const internalThemes: Theme[] = [];
export { internalThemes }
const experimentalThemes: Theme[] = [];
export { experimentalThemes }
function fillThemes(themesPath: string, themes: Theme[]) {
for (const fileName of fs.readdirSync(themesPath)) {
if (fileName == "template.ts") continue;
@@ -23,3 +27,5 @@ function fillThemes(themesPath: string, themes: Theme[]) {
fillThemes(path.resolve(`${__dirname}/themes`), themes)
fillThemes(path.resolve(`${__dirname}/themes/internal`), internalThemes)
fillThemes(path.resolve(`${__dirname}/themes/experiments`), experimentalThemes)
@@ -0,0 +1,28 @@
import chroma from "chroma-js";
import { colorRamp, createTheme } from "../common/base16";
const name = "cave-experiments";
const ramps = {
neutral: chroma.scale([
"#555555",
"#555555",
"#555555",
"#555555",
"#555555",
"#555555",
"#555555",
"#555555",
]),
red: colorRamp(chroma("#555555")),
orange: colorRamp(chroma("#555555")),
yellow: colorRamp(chroma("#555555")),
green: colorRamp(chroma("#555555")),
cyan: colorRamp(chroma("#555555")),
blue: colorRamp(chroma("#555555")),
violet: colorRamp(chroma("#555555")),
magenta: colorRamp(chroma("#555555")),
};
export const dark = createTheme(`${name}-dark`, false, ramps);
export const light = createTheme(`${name}-light`, true, ramps);