Skip to content

Commit

Permalink
feat: Export-4BitCss -NoStyle and .dim, .Dim classes ( Fixes #43, Fixes
Browse files Browse the repository at this point in the history
#52 )
  • Loading branch information
James Brundage committed Apr 20, 2024
1 parent 15ec6d3 commit 29d0312
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions Commands/Export-4BitCSS.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,21 @@ function Export-4BitCSS
[switch]
$NoBackgroundColor,

# If set, will not generate css classes that correspond to `$psStyle`.
[Alias('NoStyles','NoPSStyle','NoPSStyles')]
[switch]
$NoStyle,

# If set, will not include CSS for common page elements
[Alias('NoElements')]
[switch]
$NoElement,
$NoElement,

# If set, will generate minimal css (not minimized)
# Implies all other -No* switches
[Alias('VariablesOnly')]
[switch]
$Minimal
$Minimal
)

process {
Expand Down Expand Up @@ -237,7 +242,8 @@ function Export-4BitCSS
$NoFill = $true
$NoElement = $true
$NoStroke = $true
$NoBackgroundColor = $true
$NoBackgroundColor = $true
$NoStyle = $true
}

$rgb = ($Background -replace "#", "0x" -replace ';') -as [UInt32]
Expand All @@ -249,7 +255,8 @@ function Export-4BitCSS
$IsBright = $luma -gt .5

$cssFile = (Join-Path $OutputPath "$($name | Convert-4BitName).css")
$className = $Name -replace '\s' -replace '^\d', '_$0'
$className = $Name -replace '\s' -replace '^\d', '_$0'

$cssContent = @(
@"
:root {
Expand Down Expand Up @@ -405,6 +412,12 @@ if (-not $NoStroke) {
"@
}

if (-not $NoStyle) {
@"
"@
}

if (-not $NoElement) {
@"
Expand Down Expand Up @@ -439,6 +452,12 @@ hr {
color: var(--foreground)
}
"@
}

if (-not $NoStyle) {
@"
.dim, .Dim { opacity: .5; }
"@
}
) -join [Environment]::NewLine
$cssContent | Set-Content -Path $cssFile
Expand Down

0 comments on commit 29d0312

Please sign in to comment.