1
+ var defaultTheme = "Konsolas" ;
2
+ function GetColorSchemeList ( ) {
3
+ return [
4
+ "'Terminal Basic','3024 Day','3024 Night','Aardvark Blue','Abernathy','Adventure','AdventureTime','Afterglow','Alabaster','AlienBlood','Andromeda','Apple Classic','Apple System Colors','arcoiris','Argonaut','Arthur','AtelierSulphurpool','Atom','AtomOneLight','Aurora','Ayu Mirage','ayu_light','ayu','Banana Blueberry','Batman','Belafonte Day','Belafonte Night','BirdsOfParadise','Blazer','Blue Matrix','BlueBerryPie','BlueDolphin','BlulocoDark','BlulocoLight','Borland','Breeze','Bright Lights','Broadcast','Brogrammer','Builtin Dark','Builtin Light','Builtin Pastel Dark','Builtin Solarized Dark','Builtin Solarized Light','Builtin Tango Dark','Builtin Tango Light','C64','Calamity','catppuccin-frappe','catppuccin-latte','catppuccin-macchiato','catppuccin-mocha','CGA','Chalk','Chalkboard','ChallengerDeep','Chester','Ciapre','CLRS','Cobalt Neon','Cobalt2','coffee_theme','CrayonPonyFish','Cyberdyne','cyberpunk','Dark Pastel','Dark+','darkermatrix','darkmatrix','Darkside','dayfox','deep','Desert','DimmedMonokai','Django','DjangoRebornAgain','DjangoSmooth','Doom Peacock','DoomOne','DotGov','Dracula','Dracula+','duckbones','Duotone Dark','Earthsong','Elemental','Elementary','ENCOM','Espresso Libre','Espresso','Everblush','Fahrenheit','Fairyfloss','Fideloper','Firefly Traditional','FirefoxDev','Firewatch','FishTank','Flat','Flatland','flexoki-dark','flexoki-light','Floraverse','ForestBlue','Framer','FrontEndDelight','FunForrest','Galaxy','Galizur','GitHub Dark','Github','Glacier','Grape','Grass','Grey-green','Gruvbox Light','GruvboxDark','GruvboxDarkHard','Guezwhoz','Hacktober','Hardcore','Harper','HaX0R_BLUE','HaX0R_GR33N','HaX0R_R3D','Highway','Hipster Green','Hivacruz','Homebrew','Hopscotch.256','Hopscotch','Hurtado','Hybrid','IC_Green_PPL','IC_Orange_PPL','iceberg-dark','iceberg-light','idea','idleToes','IR_Black','iTerm2 Dark Background','iTerm2 Default','iTerm2 Light Background','iTerm2 Pastel Dark Background','iTerm2 Smoooooth','iTerm2 Solarized Dark','iTerm2 Solarized Light','iTerm2 Tango Dark','iTerm2 Tango Light','Jackie Brown','Japanesque','Jellybeans','JetBrains Darcula','jubi','kanagawabones','Kibble','Kolorit','Konsolas','Lab Fox','Laser','Later This Evening','Lavandula','LiquidCarbon','LiquidCarbonTransparent','LiquidCarbonTransparentInverse','lovelace','Man Page','Mariana','Material','MaterialDark','MaterialDarker','MaterialDesignColors','MaterialOcean','Mathias','matrix','Medallion','midnight-in-mojave','Mirage','Misterioso','Molokai','MonaLisa','Monokai Remastered','Monokai Soda','Monokai Vivid','N0tch2k','neobones_dark','neobones_light','Neon','Neopolitan','Neutron','Night Owlish Light','nightfox','NightLion v1','NightLion v2','niji','Nocturnal Winter','nord-light','nord','Novel','Obsidian','Ocean','Oceanic-Next','OceanicMaterial','Ollie','OneHalfDark','OneHalfLight','Operator Mono Dark','Overnight Slumber','PaleNightHC','Pandora','Paraiso Dark','PaulMillr','PencilDark','PencilLight','Peppermint','Piatto Light','Pnevma','Popping and Locking','primary','Pro Light','Pro','Purple Rain','purplepeter','Rapture','Raycast_Dark','Raycast_Light','rebecca','Red Alert','Red Planet','Red Sands','Relaxed','Retro','Rippedcasts','rose-pine-dawn','rose-pine-moon','rose-pine','Rouge 2','Royal','Ryuuko','Sakura','Scarlet Protocol','Seafoam Pastel','SeaShells','seoulbones_dark','seoulbones_light','Seti','shades-of-purple','Shaman','Slate','SleepyHollow','Smyck','Snazzy','SoftServer','Solarized Darcula','Solarized Dark - Patched','Solarized Dark Higher Contrast','Spacedust','SpaceGray Eighties Dull','SpaceGray Eighties','SpaceGray','Spiderman','Spring','Square','Sublette','Subliminal','Sundried','Symfonic','synthwave-everything','synthwave','SynthwaveAlpha','Tango Adapted','Tango Half Adapted','Teerb','terafox','Terminal Basic','Thayer Bright','The Hulk','Tinacious Design (Dark)','Tinacious Design (Light)','tokyonight-day','tokyonight-storm','tokyonight','Tomorrow Night Blue','Tomorrow Night Bright','Tomorrow Night Burns','Tomorrow Night Eighties','Tomorrow Night','Tomorrow','ToyChest','Treehouse','Twilight','Ubuntu','UltraDark','UltraViolent','UnderTheSea','Unikitty','Urple','Vaughn','VibrantInk','vimbones','Violet Dark','Violet Light','WarmNeon','Wez','Whimsy','WildCherry','wilmersdorf','Wombat','Wryan','zenbones_dark','zenbones_light','zenbones','Zenburn','zenburned','zenwritten_dark','zenwritten_light'"
5
+ ]
6
+ }
7
+
8
+ function GetDarkColorSchemes ( ) {
9
+ return [
10
+ "'3024 Night','Aardvark Blue','Abernathy','Adventure','AdventureTime','Afterglow','AlienBlood','Andromeda','Apple Classic','Apple System Colors','arcoiris','Argonaut','Arthur','AtelierSulphurpool','Atom','Aurora','Ayu Mirage','ayu','Banana Blueberry','Batman','Belafonte Night','BirdsOfParadise','Blazer','Blue Matrix','BlueBerryPie','BlueDolphin','BlulocoDark','Borland','Breeze','Bright Lights','Broadcast','Brogrammer','Builtin Dark','Builtin Pastel Dark','Builtin Solarized Dark','Builtin Tango Dark','C64','Calamity','catppuccin-frappe','catppuccin-macchiato','catppuccin-mocha','CGA','Chalk','Chalkboard','ChallengerDeep','Chester','Ciapre','Cobalt Neon','Cobalt2','CrayonPonyFish','Cyberdyne','cyberpunk','Dark Pastel','Dark+','darkermatrix','darkmatrix','Darkside','deep','Desert','DimmedMonokai','Django','DjangoRebornAgain','DjangoSmooth','Doom Peacock','DoomOne','DotGov','Dracula','Dracula+','duckbones','Duotone Dark','Earthsong','Elemental','Elementary','ENCOM','Espresso Libre','Espresso','Everblush','Fahrenheit','Fairyfloss','Fideloper','Firefly Traditional','FirefoxDev','Firewatch','FishTank','Flat','Flatland','flexoki-dark','Floraverse','ForestBlue','Framer','FrontEndDelight','FunForrest','Galaxy','Galizur','GitHub Dark','Glacier','Grape','Grass','Grey-green','GruvboxDark','GruvboxDarkHard','Guezwhoz','Hacktober','Hardcore','Harper','HaX0R_BLUE','HaX0R_GR33N','HaX0R_R3D','Highway','Hipster Green','Hivacruz','Homebrew','Hopscotch.256','Hopscotch','Hurtado','Hybrid','IC_Green_PPL','IC_Orange_PPL','iceberg-dark','idea','idleToes','IR_Black','iTerm2 Dark Background','iTerm2 Default','iTerm2 Pastel Dark Background','iTerm2 Smoooooth','iTerm2 Solarized Dark','iTerm2 Tango Dark','Jackie Brown','Japanesque','Jellybeans','JetBrains Darcula','jubi','kanagawabones','Kibble','Kolorit','Konsolas','Lab Fox','Laser','Later This Evening','Lavandula','LiquidCarbon','LiquidCarbonTransparent','LiquidCarbonTransparentInverse','lovelace','Mariana','MaterialDark','MaterialDarker','MaterialDesignColors','MaterialOcean','Mathias','matrix','Medallion','midnight-in-mojave','Mirage','Misterioso','Molokai','MonaLisa','Monokai Remastered','Monokai Soda','Monokai Vivid','N0tch2k','neobones_dark','Neon','Neopolitan','Neutron','nightfox','NightLion v1','NightLion v2','niji','Nocturnal Winter','nord','Obsidian','Ocean','Oceanic-Next','OceanicMaterial','Ollie','OneHalfDark','Operator Mono Dark','Overnight Slumber','PaleNightHC','Pandora','Paraiso Dark','PaulMillr','PencilDark','Peppermint','Pnevma','Popping and Locking','Pro','Purple Rain','purplepeter','Rapture','Raycast_Dark','rebecca','Red Alert','Red Planet','Red Sands','Relaxed','Retro','Rippedcasts','rose-pine-moon','rose-pine','Rouge 2','Royal','Ryuuko','Sakura','Scarlet Protocol','Seafoam Pastel','SeaShells','seoulbones_dark','Seti','shades-of-purple','Shaman','Slate','SleepyHollow','Smyck','Snazzy','SoftServer','Solarized Darcula','Solarized Dark - Patched','Solarized Dark Higher Contrast','Spacedust','SpaceGray Eighties Dull','SpaceGray Eighties','SpaceGray','Spiderman','Square','Sublette','Subliminal','Sundried','Symfonic','synthwave-everything','synthwave','SynthwaveAlpha','Teerb','terafox','Thayer Bright','The Hulk','Tinacious Design (Dark)','tokyonight-storm','tokyonight','Tomorrow Night Blue','Tomorrow Night Bright','Tomorrow Night Burns','Tomorrow Night Eighties','Tomorrow Night','ToyChest','Treehouse','Twilight','Ubuntu','UltraDark','UltraViolent','UnderTheSea','Urple','Vaughn','VibrantInk','Violet Dark','WarmNeon','Wez','Whimsy','WildCherry','wilmersdorf','Wombat','Wryan','zenbones_dark','Zenburn','zenburned','zenwritten_dark'"
11
+ ]
12
+ }
13
+
14
+ function GetLightColorSchemes ( ) {
15
+ return [
16
+ "''"
17
+ ]
18
+ }
19
+
20
+ function feelingLucky ( ) {
21
+ var colorSchemes = GetColorSchemeList ( ) ;
22
+ var randomNumber = Math . floor ( Math . random ( ) * colorSchemes . length ) ;
23
+ var fourBitCssLink = document . getElementById ( "4bitcss" ) ;
24
+ if ( ! fourBitCssLink ) {
25
+ throw "Must have a stylesheet link with the id '4bitcss'"
26
+ }
27
+ SetColorScheme ( colorSchemes [ randomNumber ] )
28
+
29
+ for ( arg in arguments ) {
30
+ if ( arguments [ arg ] . value ) {
31
+ arguments [ arg ] . value = colorSchemes [ randomNumber ] ;
32
+ }
33
+ }
34
+ }
35
+
36
+ function SetColorScheme ( colorSchemeName ) {
37
+ var fourBitCssLink = document . getElementById ( "4bitcss" ) ;
38
+ if ( ! fourBitCssLink ) {
39
+ throw "Must have a stylesheet link with the id '4bitcss'"
40
+ }
41
+ var foundScheme = GetColorSchemeList ( ) . find ( element => element == colorSchemeName ) ;
42
+ if ( ! foundScheme ) {
43
+ throw ( "Color Scheme '" + colorSchemeName + "' does not exist" ) ;
44
+ }
45
+ fourBitCssLink . href = "/" + foundScheme + ".css" ;
46
+ fourBitCssLink . themeName = foundScheme ;
47
+ var downloadLink = document . getElementById ( "downloadSchemeLink" ) ;
48
+ if ( downloadLink ) {
49
+ downloadLink . href = "/" + foundScheme + ".css" ;
50
+ }
51
+ var cdnLink = document . getElementById ( "cdnSchemeLink" )
52
+ if ( cdnLink ) {
53
+ cdnLink . href = "https://cdn.jsdelivr.net/gh/2bitdesigns/4bitcss@latest/css/" + foundScheme + ".css" ;
54
+ }
55
+
56
+ var colorSchemeNameLink = document . getElementById ( "colorSchemeNameLink" )
57
+ if ( colorSchemeNameLink ) {
58
+ colorSchemeNameLink . href = "https://4bitcss.com/" + foundScheme ;
59
+ }
60
+
61
+ var schemeSelector = document . getElementById ( "schemeSelector" ) ;
62
+ if ( schemeSelector ) {
63
+ schemeSelector . value = foundScheme ;
64
+ }
65
+ }
66
+
67
+ function GetCSSVariable ( name ) {
68
+ var root = document . querySelector ( ":root" ) ;
69
+ var rootStyle = getComputedStyle ( root ) ;
70
+ return rootStyle . getPropertyValue ( name ) ;
71
+ }
72
+
73
+ function saveTheme ( ) {
74
+ var fourBitCssLink = document . getElementById ( "4bitcss" ) ;
75
+ if ( ! fourBitCssLink ) {
76
+ throw "Must have a stylesheet link with the id '4bitcss'"
77
+ }
78
+ if ( typeof ( Storage ) == "undefined" ) {
79
+ throw "Cannot save themes without HTML5 Local Storage"
80
+ }
81
+
82
+ localStorage . setItem ( "savedThemeLink" , fourBitCssLink . themeName ) ;
83
+ }
84
+
85
+ function loadTheme ( ) {
86
+ if ( typeof ( Storage ) == "undefined" ) {
87
+ throw "Cannot save themes without HTML5 Local Storage"
88
+ }
89
+ var previouslySaved = localStorage . getItem ( "savedThemeLink" ) ;
90
+ if ( previouslySaved ) {
91
+ SetColorScheme ( previouslySaved ) ;
92
+ }
93
+ for ( arg in arguments ) {
94
+ if ( arguments [ arg ] . value ) {
95
+ arguments [ arg ] . value = previouslySaved ;
96
+ }
97
+ }
98
+ }
0 commit comments