Skip to content

Commit

Permalink
Merge pull request #3 from doki-theme/highRes
Browse files Browse the repository at this point in the history
2560x1440 Themes
  • Loading branch information
Unthrottled authored Jul 10, 2020
2 parents daed786 + 26fbd5e commit 4246ab4
Show file tree
Hide file tree
Showing 77 changed files with 1,978 additions and 18 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Changelog
---

## 1.1.0 [High Resolution]

- Added themes with 2560x1440 background images.
- Those themes are available in the `chromeThemes_2560x1440` directory.
- Not every Doki-Theme had a high resolution wallpaper. If your favorite is not present, please submit an issue.

## 1.0.0 [Initial release!]

All 24 Themes are available in the `chromeThemes` directory.
6 changes: 4 additions & 2 deletions buildSrc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@types/chrome": "^0.0.115",
"@types/jest": "^26.0.0",
"@types/lodash": "^4.14.155",
"@types/ncp": "^2.0.4",
"copy-webpack-plugin": "^6.0.2",
"jest": "^26.0.1",
"rimraf": "^3.0.2",
Expand All @@ -23,9 +24,10 @@
"webpack-merge": "^4.2.2"
},
"dependencies": {
"jimp": "^0.13.0"
"jimp": "^0.13.0",
"ncp": "^2.0.0"
},
"scripts": {
"buildThemes": "ts-node ./buildSrc/BuildThemes.ts"
"buildThemes": "ts-node ./src/BuildThemes.ts"
}
}
62 changes: 46 additions & 16 deletions buildSrc/src/BuildThemes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const repoDirectory = path.resolve(__dirname, '..', '..');

const generatedThemesDirectory = path.resolve(repoDirectory, 'chromeThemes');

const hiResGeneratedThemesDirectory = path.resolve(repoDirectory, 'chromeThemes_2560x1440');

const fs = require('fs');

const masterThemeDefinitionDirectoryPath =
Expand Down Expand Up @@ -286,7 +288,7 @@ function buildChromeThemeManifest(
...manifestTheme,
images: replaceValues(
manifestTheme.images,
(_,value) => value || `images/${
(_, value) => value || `images/${
dokiThemeDefinition.stickers.secondary ||
dokiThemeDefinition.stickers.default
}`
Expand Down Expand Up @@ -403,6 +405,7 @@ const getStickers = (
};

const jimp = require('jimp');
const ncp = require('ncp').ncp;
const omit = require('lodash/omit');

console.log('Preparing to generate themes.');
Expand Down Expand Up @@ -470,7 +473,7 @@ walkDir(chromeDefinitionDirectoryPath)
.map(({
dokiFileDefinitionPath,
dokiThemeDefinition,
dokiThemeChromeDefinition,
dokiThemeChromeDefinition,
manifestTemplate
}) =>
createDokiTheme(
Expand All @@ -485,6 +488,8 @@ walkDir(chromeDefinitionDirectoryPath)
// write things for extension
return dokiThemes.reduce((accum, theme) =>
accum.then(() => {
const chromeThemeName = `${theme.definition.name}'s Theme`;
const stickers = getStickers(theme.definition, theme);
const themeDirectory = path.resolve(
generatedThemesDirectory,
`${theme.definition.name}'s Theme`
Expand Down Expand Up @@ -544,31 +549,56 @@ walkDir(chromeDefinitionDirectoryPath)
}))
})
.then(() => {
//write manifest
fs.writeFileSync(
path.resolve(themeDirectory, 'manifest.json'),
JSON.stringify(theme.manifest, null, 2)
);

// copy asset to directory
const stickers = getStickers(theme.definition, theme);
const storageShedPath = path.resolve(repoDirectory, '..', 'storage-shed', 'doki', 'backgrounds', 'chrome')
const highResTheme = [
path.resolve(storageShedPath, 'hi-res', stickers.secondary && stickers.secondary.name || 'not_real'),
path.resolve(storageShedPath, 'hi-res', stickers.default.name),
].filter(hiResWaifu => fs.existsSync(hiResWaifu))[0];
if (highResTheme) {
const highResThemeDirectory = path.resolve(hiResGeneratedThemesDirectory, chromeThemeName);
return new Promise((resolve, reject) => {
ncp(themeDirectory, highResThemeDirectory, {
clobber: true,
}, (err: Error[] | null) => {
if (err) {
console.log(err)
reject(err)
} else {
const highResbackgroundDirectory = path.resolve(highResThemeDirectory, 'images');
fs.copyFileSync(
highResTheme,
path.resolve(highResbackgroundDirectory, path.basename(highResTheme))
)
resolve()
}
})
})
} else {
return Promise.resolve()
}
}).then(() => {
const backgroundName =
stickers.secondary &&
stickers.secondary.name ||
stickers.default.name;

const chromeTester = path.resolve("/home/alex/workspace/storage-shed/doki/backgrounds/chrome",
const chromeLowRes = path.resolve(repoDirectory, '..', 'storage-shed', 'doki', 'backgrounds', 'chrome',
backgroundName);
const src = fs.existsSync(chromeTester) ?
chromeTester: path.resolve(repoDirectory, '..', 'doki-theme-assets', 'backgrounds', backgroundName);

const src = fs.existsSync(chromeLowRes) ?
chromeLowRes : path.resolve(repoDirectory, '..', 'doki-theme-assets', 'backgrounds', backgroundName);
fs.copyFileSync(
src,
path.resolve(backgroundDirectory, backgroundName)
)

//write manifest
fs.writeFileSync(
path.resolve(themeDirectory, 'manifest.json'),
JSON.stringify(theme.manifest, null, 2)
);
});
}), Promise.resolve())
.then(()=>{
.then(() => {
// write things for extension
const dokiThemeDefinitions = dokiThemes.map(dokiTheme => {
const dokiDefinition = dokiTheme.definition;
Expand All @@ -588,7 +618,7 @@ walkDir(chromeDefinitionDirectoryPath)

const finalDokiDefinitions = JSON.stringify(dokiThemeDefinitions);
fs.writeFileSync(
path.resolve(repoDirectory,'masterExtension', 'src', 'DokiThemeDefinitions.ts'),
path.resolve(repoDirectory, 'masterExtension', 'src', 'DokiThemeDefinitions.ts'),
`export default ${finalDokiDefinitions};`);
});
})
Expand Down
12 changes: 12 additions & 0 deletions buildSrc/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,13 @@
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.155.tgz#e2b4514f46a261fd11542e47519c20ebce7bc23a"
integrity sha512-vEcX7S7aPhsBCivxMwAANQburHBtfN9RdyXFk84IJmu2Z4Hkg1tOFgaslRiEqqvoLtbCBi6ika1EMspE+NZ9Lg==

"@types/ncp@^2.0.4":
version "2.0.4"
resolved "https://registry.yarnpkg.com/@types/ncp/-/ncp-2.0.4.tgz#16c9e7fa2c849d429a1b142648987164b06bf490"
integrity sha512-erpimpT1pH8QfeNg77ypnjwz6CGMqrnL4DewVbqFzD9FXzSULjmG3KzjZnLNe7bzTSZm2W9DpkHyqop1g1KmgQ==
dependencies:
"@types/node" "*"

"@types/node@*":
version "14.0.13"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.13.tgz#ee1128e881b874c371374c1f72201893616417c9"
Expand Down Expand Up @@ -4146,6 +4153,11 @@ natural-compare@^1.4.0:
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=

ncp@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ncp/-/ncp-2.0.0.tgz#195a21d6c46e361d2fb1281ba38b91e9df7bdbb3"
integrity sha1-GVoh1sRuNh0vsSgbo4uR6d9727M=

neo-async@^2.5.0, neo-async@^2.6.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
112 changes: 112 additions & 0 deletions chromeThemes_2560x1440/Asuna's Theme/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{
"name": "Doki Theme: Asuna",
"version": "1.0",
"description": "A light theme modeled after Asuna from Sword Art Online",
"theme": {
"images": {
"theme_ntp_background": "images/asuna_light.png",
"theme_ntp_background_incognito": "images/asuna_light.png",
"theme_toolbar": "images/tab_highlight.png",
"theme_tab_background": "images/tab_inactive.png"
},
"colors": {
"bookmark_text": [
37,
36,
39
],
"button_background": [
249,
242,
242
],
"frame": [
255,
255,
255
],
"frame_inactive": [
252,
252,
252
],
"frame_incognito": [
252,
252,
252
],
"frame_incognito_inactive": [
255,
255,
255
],
"ntp_background": [
255,
255,
255
],
"ntp_header": [
252,
252,
252
],
"omnibox_background": [
252,
252,
252
],
"omnibox_text": [
166,
29,
13
],
"theme_toolbar": [
255,
241,
245
],
"ntp_text": [
37,
36,
39
],
"tab_background_text": [
37,
36,
39
],
"tab_background_text_inactive": [
170,
170,
170
],
"tab_text": [
37,
36,
39
],
"toolbar": [
252,
252,
252
]
},
"tints": {
"buttons": [
0.017429193899782137,
1,
0.3509803921568628
],
"frame": [
0.017429193899782137,
1,
0.3509803921568628
]
},
"properties": {
"ntp_background_alignment": "center",
"ntp_logo_alternate": 0
}
},
"manifest_version": 2
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4246ab4

Please sign in to comment.