Skip to content

Commit b16f753

Browse files
author
James Brundage
committed
feat: Template.HTML.Default.Layout - Aliasing -PaletteName to -Palette and allowing external palettes ( Fixes #1065 )
1 parent 718e67b commit b16f753

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

Languages/HTML/Templates/Layout/HTML-Default-Layout.ps.ps1

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,12 @@ Template function HTML.Default.Layout {
7777
$JavaScript,
7878

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

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

106109
# The date the page was published. If set, it will include the article:published_time meta tag.
107110
[vbn()]
@@ -229,8 +232,13 @@ Template function HTML.Default.Layout {
229232
}
230233
if ($PaletteName) {
231234
foreach ($NameOfPalette in $PaletteName) {
232-
$MachineFriendlyName = $NameOfPalette -replace '\s','-' -replace '\p{P}','-' -replace '-+','-' -replace '-$'
233-
"<link rel='stylesheet' type='text/css' href='https://cdn.jsdelivr.net/gh/2bitdesigns/4bitcss@latest/css/$MachineFriendlyName.css' id='4bitcss' />"
235+
if ($PaletteName -match '[\\/]') {
236+
"<link rel='stylesheet' type='text/css' href='$PaletteName' id='4bitcss' />"
237+
} else {
238+
$MachineFriendlyName = $NameOfPalette -replace '\s','-' -replace '\p{P}','-' -replace '-+','-' -replace '-$'
239+
"<link rel='stylesheet' type='text/css' href='https://cdn.jsdelivr.net/gh/2bitdesigns/4bitcss@latest/css/$MachineFriendlyName.css' id='4bitcss' />"
240+
}
241+
234242
}
235243
$Class += "foreground", "background"
236244
}

0 commit comments

Comments
 (0)