Skip to content

Commit

Permalink
feat: 4bitjs ( Fixes #32 )
Browse files Browse the repository at this point in the history
  • Loading branch information
James Brundage committed Jan 14, 2024
1 parent 09c0510 commit d4b54fa
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 12 deletions.
9 changes: 8 additions & 1 deletion 4bitcss.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,11 @@ $darkColorSchemes |
ConvertTo-Json |
Set-Content -Path $allDarkSchemesPath

Get-Item -Path $allSchemesPath
Get-Item -Path $allSchemesPath

$4bitJS = Export-4BitJS -ColorSchemeName $allColorSchemes -DarkColorSchemeName $darkColorSchemes -LightColorSchemeName $LightColorSchemeName

$4bitJSDocsPath = Join-Path $docsPath "js" | Join-Path -ChildPath "4bit.js"
New-Item -ItemType File -Path $4bitJSDocsPath -Force -Value $4bitJS

New-Item -ItemType File -Path ".\4bit.js" -Force -Value $4bitJS
60 changes: 49 additions & 11 deletions docs/js/4bit.ps.js → Export-4BitJS.ps1
Original file line number Diff line number Diff line change
@@ -1,14 +1,50 @@
var defaultTheme = "Konsolas";
function Export-4BitJS {
<#
.SYNOPSIS
Exports 4bitJS
.DESCRIPTION
Exports JavaScript to change 4bitCSS themes.
#>
[Alias('Template.4bit.js','Template.JavaScript.4bit')]
param(
# The names of all color schemes
[Alias('ColorSchemeNames')]
[string[]]
$ColorSchemeName,

# The names of all dark color schemes
[Alias('DarkColorSchemeNames')]
[string[]]
$DarkColorSchemeName,

# The names of all light color schemes
[Alias('LightColorSchemeNames')]
[string[]]
$LightColorSchemeName,

# The default color scheme to use.
[string]
$DefaultColorScheme = 'Konsolas'
)

@"
var defaultTheme = "$DefaultColorScheme";
function GetColorSchemeList() {
return [/*{
"'$(
@($pwd |
Split-Path |
Get-ChildItem -Filter *.css |
% { $_.Name -replace '\.css$' }
) -join "','"
)'"
}*/]
return [
"'$($ColorSchemeName -join "','")'"
]
}
function GetDarkColorSchemes() {
return [
"'$($DarkColorSchemeName -join "','")'"
]
}
function GetLightColorSchemes() {
return [
"'$($LightColorSchemeName -join "','")'"
]
}
function feelingLucky() {
Expand Down Expand Up @@ -89,4 +125,6 @@ function loadTheme() {
arguments[arg].value = previouslySaved;
}
}
}
}
"@
}

0 comments on commit d4b54fa

Please sign in to comment.