[Build] Add linter
This commit is contained in:
		| @@ -9,7 +9,9 @@ const renderColourAsHex = util.renderColourAsHex; | ||||
| //          │   Theme generator (returns theme as object)   │ | ||||
| //          ╰───────────────────────────────────────────────╯ | ||||
| // ─────────────────────────────────────────────────────────────────── | ||||
| module.exports.generateTheme = ( theme, wallpaper, lockpaper, palette ) => { | ||||
| module.exports.generateTheme = ( | ||||
|     theme, wallpaper, lockpaper, palette | ||||
| ) => { | ||||
|     return { | ||||
|         'wallpaper-path': wallpaper, | ||||
|         'lockpaper-path': lockpaper, | ||||
| @@ -49,14 +51,30 @@ module.exports.generateTheme = ( theme, wallpaper, lockpaper, palette ) => { | ||||
|         'colour-accent-rgba-007': renderColourAsRGBA( palette[ 0 ], 0.07 ), | ||||
|         'colour-accent-hyprland': util.renderColourAsRGBAHex( palette[ 0 ], 0.8 ), | ||||
|         // ─────────────────────────────────────────────────────────────────── | ||||
|         'colour-accent-gradient-1-hex': renderColourAsHex( util.getGradientColour( palette[ 0 ], 1, gradientMultipliers[ theme ] ) ), | ||||
|         'colour-accent-gradient-2-hex': renderColourAsHex( util.getGradientColour( palette[ 0 ], 2, gradientMultipliers[ theme ] ) ), | ||||
|         'colour-accent-gradient-3-hex': renderColourAsHex( util.getGradientColour( palette[ 0 ], 3, gradientMultipliers[ theme ] ) ), | ||||
|         'colour-accent-gradient-4-hex': renderColourAsHex( util.getGradientColour( palette[ 0 ], 4, gradientMultipliers[ theme ] ) ), | ||||
|         'colour-accent-gradient-5-hex': renderColourAsHex( util.getGradientColour( palette[ 0 ], 5, gradientMultipliers[ theme ] ) ), | ||||
|         'colour-accent-gradient-inverse-1-hex': renderColourAsHex( util.getGradientColour( palette[ 0 ], 1, 1 / gradientMultipliers[ theme ] ) ), | ||||
|         'colour-accent-gradient-inverse-2-hex': renderColourAsHex( util.getGradientColour( palette[ 0 ], 1, 1 / gradientMultipliers[ theme ] ) ), | ||||
|         'colour-accent-gradient-inverse-3-hex': renderColourAsHex( util.getGradientColour( palette[ 0 ], 1, 1 / gradientMultipliers[ theme ] ) ), | ||||
|         'colour-accent-gradient-1-hex': renderColourAsHex( util.getGradientColour( | ||||
|             palette[ 0 ], 1, gradientMultipliers[ theme ] | ||||
|         ) ), | ||||
|         'colour-accent-gradient-2-hex': renderColourAsHex( util.getGradientColour( | ||||
|             palette[ 0 ], 2, gradientMultipliers[ theme ] | ||||
|         ) ), | ||||
|         'colour-accent-gradient-3-hex': renderColourAsHex( util.getGradientColour( | ||||
|             palette[ 0 ], 3, gradientMultipliers[ theme ] | ||||
|         ) ), | ||||
|         'colour-accent-gradient-4-hex': renderColourAsHex( util.getGradientColour( | ||||
|             palette[ 0 ], 4, gradientMultipliers[ theme ] | ||||
|         ) ), | ||||
|         'colour-accent-gradient-5-hex': renderColourAsHex( util.getGradientColour( | ||||
|             palette[ 0 ], 5, gradientMultipliers[ theme ] | ||||
|         ) ), | ||||
|         'colour-accent-gradient-inverse-1-hex': renderColourAsHex( util.getGradientColour( | ||||
|             palette[ 0 ], 1, 1 / gradientMultipliers[ theme ] | ||||
|         ) ), | ||||
|         'colour-accent-gradient-inverse-2-hex': renderColourAsHex( util.getGradientColour( | ||||
|             palette[ 0 ], 1, 1 / gradientMultipliers[ theme ] | ||||
|         ) ), | ||||
|         'colour-accent-gradient-inverse-3-hex': renderColourAsHex( util.getGradientColour( | ||||
|             palette[ 0 ], 1, 1 / gradientMultipliers[ theme ] | ||||
|         ) ), | ||||
|  | ||||
|         // ── Secondary accent ───────────────────────────────────────────── | ||||
|         'colour-accent-2-hex': renderColourAsHex( palette[ 1 ] ), | ||||
| @@ -154,9 +172,9 @@ module.exports.generateTheme = ( theme, wallpaper, lockpaper, palette ) => { | ||||
|         // ┌                                               ┐ | ||||
|         // │           Path to this repo on disk           │ | ||||
|         // └                                               ┘ | ||||
|         'path-to-dotfiles': __dirname.slice(0, __dirname.length - 5), | ||||
|     } | ||||
| } | ||||
|         'path-to-dotfiles': __dirname.slice( 0, __dirname.length - 5 ), | ||||
|     }; | ||||
| }; | ||||
|  | ||||
|  | ||||
| // ─────────────────────────────────────────────────────────────────── | ||||
| @@ -171,74 +189,265 @@ const gradientMultipliers = { | ||||
|     'light': 1.1, | ||||
|     'bright': 1.15, | ||||
|     'test': 0.75 | ||||
| } | ||||
| }; | ||||
| const colours = { | ||||
|     foreground: { | ||||
|         'nordic': [ 200, 220, 255 ], | ||||
|         'deep-dark': [ 230, 230, 230 ], | ||||
|         'material': [ 255, 255, 255 ], // TODO: Will be calculated by material theme generator | ||||
|         'light': [ 40, 40, 40 ], | ||||
|         'bright': [ 0, 0, 0 ], | ||||
|         'test': [ 0, 0, 0 ], | ||||
|     'foreground': { | ||||
|         'nordic': [ | ||||
|             200, | ||||
|             220, | ||||
|             255 | ||||
|         ], | ||||
|         'deep-dark': [ | ||||
|             230, | ||||
|             230, | ||||
|             230 | ||||
|         ], | ||||
|         'material': [ | ||||
|             255, | ||||
|             255, | ||||
|             255 | ||||
|         ], // TODO: Will be calculated by material theme generator | ||||
|         'light': [ | ||||
|             40, | ||||
|             40, | ||||
|             40 | ||||
|         ], | ||||
|         'bright': [ | ||||
|             0, | ||||
|             0, | ||||
|             0 | ||||
|         ], | ||||
|         'test': [ | ||||
|             0, | ||||
|             0, | ||||
|             0 | ||||
|         ], | ||||
|     }, | ||||
|     'foreground-accent': { | ||||
|         'nordic': [ 255, 255, 255 ], | ||||
|         'deep-dark': [ 255, 255, 255 ], | ||||
|         'material': [ 200, 200, 200 ], // TODO: Will be calculated by material theme generator | ||||
|         'light': [ 0, 0, 0 ], | ||||
|         'bright': [ 50, 50, 50 ], | ||||
|         'test': [ 0, 0, 0 ], | ||||
|         'nordic': [ | ||||
|             255, | ||||
|             255, | ||||
|             255 | ||||
|         ], | ||||
|         'deep-dark': [ | ||||
|             255, | ||||
|             255, | ||||
|             255 | ||||
|         ], | ||||
|         'material': [ | ||||
|             200, | ||||
|             200, | ||||
|             200 | ||||
|         ], // TODO: Will be calculated by material theme generator | ||||
|         'light': [ | ||||
|             0, | ||||
|             0, | ||||
|             0 | ||||
|         ], | ||||
|         'bright': [ | ||||
|             50, | ||||
|             50, | ||||
|             50 | ||||
|         ], | ||||
|         'test': [ | ||||
|             0, | ||||
|             0, | ||||
|             0 | ||||
|         ], | ||||
|     }, | ||||
|     background: { | ||||
|         'nordic': [ 10, 10, 15 ], | ||||
|         'deep-dark': [ 20, 20, 20 ], | ||||
|         'material': [ 30, 30, 30 ], // TODO: Will be calculated by material theme generator | ||||
|         'light': [ 230, 230, 230 ], | ||||
|         'bright': [ 255, 255, 255 ], | ||||
|         'test': [ 255, 255, 255 ], | ||||
|     'background': { | ||||
|         'nordic': [ | ||||
|             10, | ||||
|             10, | ||||
|             15 | ||||
|         ], | ||||
|         'deep-dark': [ | ||||
|             20, | ||||
|             20, | ||||
|             20 | ||||
|         ], | ||||
|         'material': [ | ||||
|             30, | ||||
|             30, | ||||
|             30 | ||||
|         ], // TODO: Will be calculated by material theme generator | ||||
|         'light': [ | ||||
|             230, | ||||
|             230, | ||||
|             230 | ||||
|         ], | ||||
|         'bright': [ | ||||
|             255, | ||||
|             255, | ||||
|             255 | ||||
|         ], | ||||
|         'test': [ | ||||
|             255, | ||||
|             255, | ||||
|             255 | ||||
|         ], | ||||
|     }, | ||||
|     'background-alternative': { | ||||
|         'nordic': [ 20, 20, 25 ], | ||||
|         'deep-dark': [ 30, 30, 30 ], | ||||
|         'material': [ 40, 40, 40 ], // TODO: Will be calculated by material theme generator | ||||
|         'light': [ 210, 210, 210 ], | ||||
|         'bright': [ 230, 230, 230 ], | ||||
|         'test': [ 255, 255, 0 ] // brown | ||||
|         'nordic': [ | ||||
|             20, | ||||
|             20, | ||||
|             25 | ||||
|         ], | ||||
|         'deep-dark': [ | ||||
|             30, | ||||
|             30, | ||||
|             30 | ||||
|         ], | ||||
|         'material': [ | ||||
|             40, | ||||
|             40, | ||||
|             40 | ||||
|         ], // TODO: Will be calculated by material theme generator | ||||
|         'light': [ | ||||
|             210, | ||||
|             210, | ||||
|             210 | ||||
|         ], | ||||
|         'bright': [ | ||||
|             230, | ||||
|             230, | ||||
|             230 | ||||
|         ], | ||||
|         'test': [ | ||||
|             255, | ||||
|             255, | ||||
|             0 | ||||
|         ] // brown | ||||
|     }, | ||||
|     'background-tertiary': { | ||||
|         'nordic': [ 0, 0, 0 ], | ||||
|         'deep-dark': [ 45, 45, 45 ], | ||||
|         'material': [ 0, 0, 0 ], // TODO: Will be calculated by material theme generator | ||||
|         'light': [ 180, 180, 180 ], | ||||
|         'bright': [ 200, 200, 200 ], | ||||
|         'test': [ 255, 0, 255 ] // purple | ||||
|         'nordic': [ | ||||
|             0, | ||||
|             0, | ||||
|             0 | ||||
|         ], | ||||
|         'deep-dark': [ | ||||
|             45, | ||||
|             45, | ||||
|             45 | ||||
|         ], | ||||
|         'material': [ | ||||
|             0, | ||||
|             0, | ||||
|             0 | ||||
|         ], // TODO: Will be calculated by material theme generator | ||||
|         'light': [ | ||||
|             180, | ||||
|             180, | ||||
|             180 | ||||
|         ], | ||||
|         'bright': [ | ||||
|             200, | ||||
|             200, | ||||
|             200 | ||||
|         ], | ||||
|         'test': [ | ||||
|             255, | ||||
|             0, | ||||
|             255 | ||||
|         ] // purple | ||||
|     }, | ||||
|     shadow: { | ||||
|         'nordic': [ 0, 0, 2 ], | ||||
|         'deep-dark': [ 40, 40, 40 ], | ||||
|         'material': [ 30, 30, 30 ], // TODO: Will be calculated by material theme generator | ||||
|         'light': [ 190, 190, 190 ], | ||||
|         'bright': [ 150, 150, 150 ], | ||||
|         'test': [ 120, 0, 0 ] // dark red | ||||
|     'shadow': { | ||||
|         'nordic': [ | ||||
|             0, | ||||
|             0, | ||||
|             2 | ||||
|         ], | ||||
|         'deep-dark': [ | ||||
|             40, | ||||
|             40, | ||||
|             40 | ||||
|         ], | ||||
|         'material': [ | ||||
|             30, | ||||
|             30, | ||||
|             30 | ||||
|         ], // TODO: Will be calculated by material theme generator | ||||
|         'light': [ | ||||
|             190, | ||||
|             190, | ||||
|             190 | ||||
|         ], | ||||
|         'bright': [ | ||||
|             150, | ||||
|             150, | ||||
|             150 | ||||
|         ], | ||||
|         'test': [ | ||||
|             120, | ||||
|             0, | ||||
|             0 | ||||
|         ] // dark red | ||||
|     }, | ||||
|     inactive: { | ||||
|         'nordic': [ 200, 200, 200 ], | ||||
|         'deep-dark': [ 200, 200, 200 ], | ||||
|         'material': [ 200, 200, 200 ], // TODO: Will be calculated by material theme generator | ||||
|         'light': [ 65, 65, 65 ], | ||||
|         'bright': [ 60, 60, 60 ], | ||||
|         'test': [ 150, 150, 150 ] | ||||
|     'inactive': { | ||||
|         'nordic': [ | ||||
|             200, | ||||
|             200, | ||||
|             200 | ||||
|         ], | ||||
|         'deep-dark': [ | ||||
|             200, | ||||
|             200, | ||||
|             200 | ||||
|         ], | ||||
|         'material': [ | ||||
|             200, | ||||
|             200, | ||||
|             200 | ||||
|         ], // TODO: Will be calculated by material theme generator | ||||
|         'light': [ | ||||
|             65, | ||||
|             65, | ||||
|             65 | ||||
|         ], | ||||
|         'bright': [ | ||||
|             60, | ||||
|             60, | ||||
|             60 | ||||
|         ], | ||||
|         'test': [ | ||||
|             150, | ||||
|             150, | ||||
|             150 | ||||
|         ] | ||||
|     }, | ||||
|     'inactive-background': { | ||||
|         'nordic': [ 0, 0, 0 ], | ||||
|         'deep-dark': [ 0, 0, 0 ], | ||||
|         'material': [ 255, 255, 255 ], // TODO: Will be calculated by material theme generator | ||||
|         'light': [ 80, 80, 80 ], | ||||
|         'bright': [ 60, 60, 60 ], | ||||
|         'test': [ 60, 60, 60 ] | ||||
|         'nordic': [ | ||||
|             0, | ||||
|             0, | ||||
|             0 | ||||
|         ], | ||||
|         'deep-dark': [ | ||||
|             0, | ||||
|             0, | ||||
|             0 | ||||
|         ], | ||||
|         'material': [ | ||||
|             255, | ||||
|             255, | ||||
|             255 | ||||
|         ], // TODO: Will be calculated by material theme generator | ||||
|         'light': [ | ||||
|             80, | ||||
|             80, | ||||
|             80 | ||||
|         ], | ||||
|         'bright': [ | ||||
|             60, | ||||
|             60, | ||||
|             60 | ||||
|         ], | ||||
|         'test': [ | ||||
|             60, | ||||
|             60, | ||||
|             60 | ||||
|         ] | ||||
|     } | ||||
| } | ||||
|  | ||||
| }; | ||||
| const fonts = { | ||||
|     'primary': { | ||||
|         'nordic': 'Comfortaa', | ||||
| @@ -261,20 +470,18 @@ const fonts = { | ||||
|         'light': 'Jetbrains Mono', | ||||
|         'bright': 'Jetbrains Mono', | ||||
|     } | ||||
| } | ||||
|  | ||||
| }; | ||||
| const iconTheme = { | ||||
|     'nordic': 'Candy', | ||||
|     'deep-dark': 'Candy', | ||||
|     'material': 'Candy', | ||||
|     'light': 'Candy', | ||||
|     'bright': 'Candy' | ||||
| } | ||||
|  | ||||
| }; | ||||
| const yaziThemes = { | ||||
|     'nordic': 'tokyo-night', | ||||
|     'deep-dark': 'vscode-dark-modern', | ||||
|     'material': 'dracula', | ||||
|     'light': 'vscode-light-modern', | ||||
|     'bright': 'vscode-light-modern', | ||||
| } | ||||
| }; | ||||
|   | ||||
| @@ -1,29 +1,37 @@ | ||||
| const fs = require( 'fs' ); | ||||
|  | ||||
| const path = require( 'path' ); | ||||
|  | ||||
| const data = '' + fs.readFileSync( '/usr/share/themes/Material-Black-Blueberry/gtk-4.0/gtk.css' ); | ||||
|  | ||||
| let lineNumber = 1; | ||||
|  | ||||
| const indexer = {}; | ||||
| for (let i = 0; i < data.length; i++) { | ||||
|  | ||||
| for ( let i = 0; i < data.length; i++ ) { | ||||
|     const char = data[i]; | ||||
|      | ||||
|  | ||||
|     if ( char === '\n' ) { | ||||
|         lineNumber++; | ||||
|     } else if ( char === '#' ) { | ||||
|         const extract = data.substring( i ); | ||||
|         const col = extract.slice( 0, extract.indexOf( '\n' ) ); | ||||
|  | ||||
|         if ( !indexer[ col ] ) { | ||||
|             indexer[ col ] = []; | ||||
|         } | ||||
|  | ||||
|         indexer[ col ].push( lineNumber ); | ||||
|     } else if ( char === 'r' ) { | ||||
|         const extract = data.substring( i ); | ||||
|  | ||||
|         if ( extract.slice( 0, 3 ) === 'rgb' ) { | ||||
|             const col = extract.slice( 0, extract.indexOf( '\n' ) ); | ||||
|  | ||||
|             if ( !indexer[ col ] ) { | ||||
|                 indexer[ col ] = []; | ||||
|             } | ||||
|  | ||||
|             indexer[ col ].push( lineNumber ); | ||||
|         } | ||||
|     } | ||||
| @@ -32,7 +40,8 @@ for (let i = 0; i < data.length; i++) { | ||||
|  | ||||
| // Output | ||||
| const keys = Object.keys( indexer ); | ||||
| for (let i = 0; i < keys.length; i++) { | ||||
|  | ||||
| for ( let i = 0; i < keys.length; i++ ) { | ||||
|     const element = keys[i]; | ||||
|  | ||||
|     if ( element.length <= 25 ) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user