Skip to content

Commit

Permalink
Merge pull request #138 from doki-theme/editorColor
Browse files Browse the repository at this point in the history
Usability & Consistency Maintenance
  • Loading branch information
Unthrottled authored Dec 28, 2021
2 parents 9911295 + 76fda27 commit 5e03546
Show file tree
Hide file tree
Showing 74 changed files with 1,008 additions and 163 deletions.
79 changes: 79 additions & 0 deletions buildSrc/ColorGenerator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import path from "path";
import fs from "fs";
import {masterThemesDirectory, walkAndBuildTemplates} from "./BuildFunctions";
import {MasterDokiThemeDefinition} from "doki-build-source";

console.log("Preparing to create color.");

type RGBArray = [number, number, number, number];

function hex_to_rgba(a: string): RGBArray {
'#' == a[0] && (a = a.substring(1));
6 > a.length && (a += '000000'.substr(0, 6 - a.length));
return [parseInt(a.substring(0, 2), 16),
parseInt(a.substring(2, 4), 16),
parseInt(a.substring(4, 6), 16),
a.length > 6 ? parseInt(a.substring(6, 8), 16) : 0xFF
];
}

function rgb_to_hex(a: RGBArray) {
const b = (a[2] | a[1] << 8 | a[0] << 16).toString(16);
return '000000'.substr(0, 6 - b.length) + b;
}

function blendColors(
base: RGBArray,
added: RGBArray,
): RGBArray {
const mix = [];
const overlayAlpha = added[3] / 0xFF;
const baseAlpha = base[3] / 0xFF;
mix[3] = 1 - (1 - overlayAlpha) * (1 - baseAlpha); // alpha
mix[0] = Math.round((added[0] * overlayAlpha / mix[3]) + (base[0] * baseAlpha * (1 - overlayAlpha) / mix[3])); // red
mix[1] = Math.round((added[1] * overlayAlpha / mix[3]) + (base[1] * baseAlpha * (1 - overlayAlpha) / mix[3])); // green
mix[2] = Math.round((added[2] * overlayAlpha / mix[3]) + (base[2] * baseAlpha * (1 - overlayAlpha) / mix[3])); // blue
return mix as RGBArray;
}

function addNewColor(dokiTheme: { dokiThemeDefinition: MasterDokiThemeDefinition; dokiFileDefinitionPath: string }) {
if(!dokiTheme.dokiThemeDefinition.dark) return;

const baseColor = hex_to_rgba(
dokiTheme.dokiThemeDefinition.colors.headerColor
);
const overlayColor = hex_to_rgba(
"#1a8bff30",
)
const gray = hex_to_rgba("#6f6f6f30")
const orange = hex_to_rgba("#e57e1a50")
const rose = hex_to_rgba("#c03a7f30")
const violet = hex_to_rgba("#6441d030")
const yellow = hex_to_rgba("#d3cb2f25")
const red = hex_to_rgba("#d0222225")
const purple = hex_to_rgba("#701fd025")

dokiTheme.dokiThemeDefinition.colors["fileYellow"] = '#' + rgb_to_hex(blendColors(baseColor, yellow))
dokiTheme.dokiThemeDefinition.colors["fileRed"] = '#' + rgb_to_hex(blendColors(baseColor, red))
dokiTheme.dokiThemeDefinition.colors["filePurple"] = '#' + rgb_to_hex(blendColors(baseColor, purple))
}

walkAndBuildTemplates()
.then((dokiThemes) => {
return dokiThemes
.reduce(
(accum, dokiTheme) =>
accum.then(() => {
addNewColor(dokiTheme);
fs.writeFileSync(dokiTheme.dokiFileDefinitionPath,
JSON.stringify(dokiTheme.dokiThemeDefinition, null, 2)
);

return Promise.resolve("dun")
}),
Promise.resolve("")
);
})
.then(() => {
console.log("Color Creation Complete!");
});
15 changes: 13 additions & 2 deletions definitions/azurLane/essex/dark/essex.dark.master.definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@
"diff.modified": "#00388C",
"diff.inserted": "#002A08",
"diff.conflict": "#3F1A22",
"diff.deleted": "#112938"
"diff.deleted": "#112938",
"lightEditorColor": "#002243",
"breakpointColor": "#152f3d",
"breakpointActiveColor": "#0c4736",
"fileBlue": "#053462",
"fileGray": "#152f47",
"fileRose": "#24254a",
"fileOrange": "#1c263c",
"fileViolet": "#132659",
"fileYellow": "#1f393c",
"fileRed": "#1e203a",
"filePurple": "#102053"
}
}
}
15 changes: 13 additions & 2 deletions definitions/blendS/maika/dark/maika.dark.master.definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@
"diff.added": "#111D11",
"diff.changed": "#0D2339",
"diff.conflict": "#451323",
"diff.deleted": "#1C1B23"
"diff.deleted": "#1C1B23",
"lightEditorColor": "#2a0635",
"breakpointColor": "#361a34",
"breakpointActiveColor": "#29342e",
"fileBlue": "#1f1e52",
"fileGray": "#2f1937",
"fileRose": "#3e0f3a",
"fileOrange": "#3b1622",
"fileViolet": "#2d1049",
"fileYellow": "#3a222b",
"fileRed": "#3a0929",
"filePurple": "#2c0942"
}
}
}
15 changes: 13 additions & 2 deletions definitions/bunnySenpai/mai/dark/mai.dark.master.definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@
"keyColor": "#50cefb",
"keywordColor": "#ebd5d4",
"diff.deleted": "#383845",
"secondaryAccentColor": "#00c69a"
"secondaryAccentColor": "#00c69a",
"lightEditorColor": "#29294e",
"breakpointColor": "#36354a",
"breakpointActiveColor": "#294c42",
"fileBlue": "#23386f",
"fileGray": "#333354",
"fileRose": "#422957",
"fileOrange": "#3f303f",
"fileViolet": "#312a66",
"fileYellow": "#3e3d4a",
"fileRed": "#3e2548",
"filePurple": "#302461"
}
}
}
17 changes: 14 additions & 3 deletions definitions/bunnySenpai/mai/light/mai.light.master.definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,19 @@
"htmlTagColor": "#7B6970",
"stringColor": "#d27f2d",
"keyColor": "#C869A3",
"constantColor":"#4C94D6",
"constantColor": "#4C94D6",
"keywordColor": "#7C75EF",
"diff.deleted": "#E9E3E7"
"diff.deleted": "#E9E3E7",
"lightEditorColor": "#f5eef2",
"breakpointColor": "#fcf2c5",
"breakpointActiveColor": "#c0f6b2",
"fileBlue": "#d4e3f8",
"fileGray": "#e4dddd",
"fileRose": "#f3c9db",
"fileOrange": "#f7d1b1",
"fileViolet": "#efd8f5",
"fileYellow": "#f1e9b8",
"fileRed": "#f0b4b3",
"filePurple": "#d2b3ea"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@
"keyColor": "#5ea7ff",
"keywordColor": "#8b8b8b",
"diff.deleted": "#262626",
"diff.inserted": "#142F14"
"diff.inserted": "#142F14",
"lightEditorColor": "#1e2122",
"breakpointColor": "#2c2d23",
"breakpointActiveColor": "#20451f",
"fileBlue": "#182e46",
"fileGray": "#28292b",
"fileRose": "#371f2e",
"fileOrange": "#342616",
"fileViolet": "#25213d",
"fileYellow": "#32331e",
"fileRed": "#321a1c",
"filePurple": "#241a35"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,19 @@
"htmlTagColor": "#7B6970",
"stringColor": "#d27f2d",
"keyColor": "#4174b3",
"constantColor":"#4C94D6",
"constantColor": "#4C94D6",
"keywordColor": "#C869A3",
"diff.deleted": "#EFE2E9"
"diff.deleted": "#EFE2E9",
"lightEditorColor": "#fae3f7",
"breakpointColor": "#fff0ce",
"breakpointActiveColor": "#c3f3ba",
"fileBlue": "#d4dbfd",
"fileGray": "#e4d6e2",
"fileRose": "#f3c1e1",
"fileOrange": "#f7cbb6",
"fileViolet": "#efd0fb",
"fileYellow": "#f1e3bc",
"fileRed": "#f0aeb8",
"filePurple": "#d2adef"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@
"diff.deleted": "#242426",
"diff.inserted": "#132A13",
"diff.modified": "#142B40",
"diff.conflict": "#3E1D1D"
"diff.conflict": "#3E1D1D",
"lightEditorColor": "#1b1b1b",
"breakpointColor": "#28271c",
"breakpointActiveColor": "#1d4019",
"fileBlue": "#1a2f45",
"fileGray": "#2a2a2a",
"fileRose": "#39202d",
"fileOrange": "#362715",
"fileViolet": "#28213c",
"fileYellow": "#35341d",
"fileRed": "#341b1b",
"filePurple": "#261b34"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@
"keyColor": "#FF357C",
"keywordColor": "#d285fd",
"diff.inserted": "#192f24",
"diff.deleted": "#2D2A36"
"diff.deleted": "#2D2A36",
"lightEditorColor": "#1f182d",
"breakpointColor": "#2d262b",
"breakpointActiveColor": "#213f26",
"fileBlue": "#1a2b4f",
"fileGray": "#2a2634",
"fileRose": "#391c37",
"fileOrange": "#36231f",
"fileViolet": "#281d46",
"fileYellow": "#352f27",
"fileRed": "#341725",
"filePurple": "#26163f"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,21 @@
"keyColor": "#176B82",
"keywordColor": "#A74503",
"constantColor": "#005CC5",
"terminal.ansiCyan": "#1fb5cd",
"terminal.ansiCyan": "#0896AD",
"diff.deleted": "#edd289",
"diff.modified": "#ecd19e",
"diff.conflict": "#f9bf7c",
"diff.inserted": "#cfe287"
"diff.inserted": "#cfe287",
"lightEditorColor": "#ffe494",
"breakpointColor": "#FCD666",
"breakpointActiveColor": "#c3ea6f",
"fileBlue": "#cdca9e",
"fileGray": "#ddc583",
"fileRose": "#ecb082",
"fileOrange": "#f1bc65",
"fileViolet": "#e7be94",
"fileYellow": "#ebd56c",
"fileRed": "#eaa068",
"filePurple": "#cc9f9f"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,26 @@
"constantColor": "#82BAFF",
"comments": "#507F78",
"unusedColor": "#64606b",

"terminal.ansiRed": "#FF7AB2",
"terminal.ansiGreen": "#54ea7c",
"terminal.ansiYellow": "#fdaa39",
"terminal.ansiBlue": "#B39AFF",
"terminal.ansiMagenta": "#FF91BF",
"terminal.ansiCyan": "#6DD6EE",

"diff.deleted": "#27423F",
"diff.conflict": "#491E1E",
"diff.inserted": "#0A5029",
"diff.modified": "#1B5496"
"diff.modified": "#1B5496",
"lightEditorColor": "#0b423b",
"breakpointColor": "#1e4a3a",
"breakpointActiveColor": "#145f33",
"fileBlue": "#0d4d5e",
"fileGray": "#1d4843",
"fileRose": "#2c3e46",
"fileOrange": "#29452e",
"fileViolet": "#1b3f55",
"fileYellow": "#275338",
"fileRed": "#273b36",
"filePurple": "#193a4f"
}
}
}
15 changes: 13 additions & 2 deletions definitions/eva/misato/dark/misato.dark.master.definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@
"stringColor": "#FAF7BA",
"keyColor": "#FF357C",
"keywordColor": "#BD84DD",
"diff.deleted": "#423943"
"diff.deleted": "#423943",
"lightEditorColor": "#3d2a3d",
"breakpointColor": "#48363a",
"breakpointActiveColor": "#3a4d33",
"fileBlue": "#36385c",
"fileGray": "#463341",
"fileRose": "#562944",
"fileOrange": "#53302c",
"fileViolet": "#442a53",
"fileYellow": "#533d35",
"fileRed": "#522533",
"filePurple": "#44244c"
}
}
}
15 changes: 13 additions & 2 deletions definitions/eva/rei/dark/rei.dark.master.definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@
"keywordColor": "#788a8b",
"diff.deleted": "#262626",
"diff.inserted": "#142F14",
"diff.conflict": "#422121"
"diff.conflict": "#422121",
"lightEditorColor": "#1d1f23",
"breakpointColor": "#2c2d25",
"breakpointActiveColor": "#204521",
"fileBlue": "#142b40",
"fileGray": "#242625",
"fileRose": "#341c28",
"fileOrange": "#312310",
"fileViolet": "#221d37",
"fileYellow": "#2f2f18",
"fileRed": "#2e1716",
"filePurple": "#20162f"
}
}
}
15 changes: 13 additions & 2 deletions definitions/fate/astolfo/dark/astolfo.dark.master.definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@
"diff.modified": "#1A233D",
"diff.inserted": "#142D14",
"diff.conflict": "#422121",
"diff.deleted": "#242424"
"diff.deleted": "#242424",
"lightEditorColor": "#1e201d",
"breakpointColor": "#2d2e1f",
"breakpointActiveColor": "#21461c",
"fileBlue": "#182e43",
"fileGray": "#282928",
"fileRose": "#381f2b",
"fileOrange": "#352613",
"fileViolet": "#26213a",
"fileYellow": "#33331a",
"fileRed": "#331a19",
"filePurple": "#251a32"
}
}
}
15 changes: 13 additions & 2 deletions definitions/fate/ishtar/dark/ishtar.dark.master.definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@
"diff.modified": "#0E2539",
"diff.inserted": "#132D14",
"diff.conflict": "#391B1B",
"diff.deleted": "#21211E"
"diff.deleted": "#21211E",
"lightEditorColor": "#161512",
"breakpointColor": "#252217",
"breakpointActiveColor": "#1a3b14",
"fileBlue": "#0f233a",
"fileGray": "#1f1e1f",
"fileRose": "#2f1422",
"fileOrange": "#2c1b0a",
"fileViolet": "#1d1531",
"fileYellow": "#2a2711",
"fileRed": "#290e0f",
"filePurple": "#1b0e28"
}
}
}
Loading

0 comments on commit 5e03546

Please sign in to comment.