diff --git a/4bitcss.build.ps1 b/4bitcss.build.ps1 index cc8a125fc4..a5bdabbfca 100644 --- a/4bitcss.build.ps1 +++ b/4bitcss.build.ps1 @@ -118,4 +118,11 @@ $darkColorSchemes | ConvertTo-Json | Set-Content -Path $allDarkSchemesPath -Get-Item -Path $allSchemesPath \ No newline at end of file +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 \ No newline at end of file diff --git a/docs/js/4bit.ps.js b/Export-4BitJS.ps1 similarity index 73% rename from docs/js/4bit.ps.js rename to Export-4BitJS.ps1 index b854815287..e477e03216 100644 --- a/docs/js/4bit.ps.js +++ b/Export-4BitJS.ps1 @@ -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() { @@ -89,4 +125,6 @@ function loadTheme() { arguments[arg].value = previouslySaved; } } -} \ No newline at end of file +} +"@ +}