Skip to content

Commit

Permalink
feat: Template.HTML.Default.Layout - Aliasing -PaletteName to -Palett…
Browse files Browse the repository at this point in the history
…e and allowing external palettes ( Fixes #1065 )
  • Loading branch information
James Brundage committed Apr 19, 2024
1 parent 718e67b commit b16f753
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Languages/HTML/Templates/Layout/HTML-Default-Layout.ps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ Template function HTML.Default.Layout {
$JavaScript,

# The name of the palette to use. If set, it will include the 4bitcss link tag.
# This is a CSS file that sets the foreground and background colors.
# If palette contains slashes, it will be presumed to be an external palette file.
# This palette file _should_ follow the same conventions as those found in [4bitcss](https://4bitcss.com).
[vbn()]
[Alias('ColorScheme','ColorPalette')]
[string]
[Alias('Palette','ColorScheme','ColorPalette')]
[string[]]
$PaletteName,

# One or more google fonts to include
Expand All @@ -101,7 +104,7 @@ Template function HTML.Default.Layout {
# The language of the page. If set, it will include the lang attribute.
[vbn()]
[cultureinfo]
$Language,
$Language = [cultureinfo]::CurrentUICulture,

# The date the page was published. If set, it will include the article:published_time meta tag.
[vbn()]
Expand Down Expand Up @@ -229,8 +232,13 @@ Template function HTML.Default.Layout {
}
if ($PaletteName) {
foreach ($NameOfPalette in $PaletteName) {
$MachineFriendlyName = $NameOfPalette -replace '\s','-' -replace '\p{P}','-' -replace '-+','-' -replace '-$'
"<link rel='stylesheet' type='text/css' href='https://cdn.jsdelivr.net/gh/2bitdesigns/4bitcss@latest/css/$MachineFriendlyName.css' id='4bitcss' />"
if ($PaletteName -match '[\\/]') {
"<link rel='stylesheet' type='text/css' href='$PaletteName' id='4bitcss' />"
} else {
$MachineFriendlyName = $NameOfPalette -replace '\s','-' -replace '\p{P}','-' -replace '-+','-' -replace '-$'
"<link rel='stylesheet' type='text/css' href='https://cdn.jsdelivr.net/gh/2bitdesigns/4bitcss@latest/css/$MachineFriendlyName.css' id='4bitcss' />"
}

}
$Class += "foreground", "background"
}
Expand Down

0 comments on commit b16f753

Please sign in to comment.