Skip to content

Commit 666a0ec

Browse files
Merge pull request #14 from 2bitdesigns/InstructionsAndAnalytics
4bitcss 0.1.1
2 parents 7ddc1d8 + d880825 commit 666a0ec

File tree

1,492 files changed

+22959
-1393
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,492 files changed

+22959
-1393
lines changed

4bitcss.PSSVG.ps1

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ if (-not (Test-Path $docsRoot)) {
1212
$null = New-Item -ItemType Directory -Path $docsRoot
1313
}
1414

15+
$fontSettings = [Ordered]@{
16+
TextAnchor = 'middle'
17+
AlignmentBaseline = 'middle'
18+
Style = "font-family: 'Abel';"
19+
}
20+
1521
$assetFile =
1622

1723
=<svg> -ViewBox 400,400 @(
@@ -22,15 +28,11 @@ $assetFile =
2228

2329
)
2430

25-
$fontSettings = @{
26-
TextAnchor = 'middle'
27-
AlignmentBaseline = 'middle'
28-
Style = "font-family: 'Abel';"
29-
}
31+
3032
=<svg.ellipse> -StrokeWidth 1.25 -Fill transparent -Cx 50% -Cy 50% -Stroke '#4488ff' -Ry 75 -Rx 50 -Class foreground-stroke
31-
=<svg.text> -FontSize 28 -Content 4bit -X 50% -Y 47.5% @fontSettings -Class foreground-fill -Fill '#4488ff'
32-
=<svg.text> -FontSize 28 -Content '⋅⋅⋅⋅' -X 50% -Y 52% @fontSettings -Class foreground-fill -Fill '#4488ff'
33-
=<svg.text> -FontSize 24 -Content 'css' -X 50% -Y 57.5% @fontSettings -Class foreground-fill -Fill '#4488ff'
33+
=<svg.text> -FontSize 28 -Content 4bit -X 50% -Y 45% @fontSettings -Class foreground-fill -Fill '#4488ff'
34+
=<svg.text> -FontSize 28 -Content '⋅⋅⋅⋅' -X 50% -Y 50% @fontSettings -Class foreground-fill -Fill '#4488ff'
35+
=<svg.text> -FontSize 28 -Content 'css' -X 50% -Y 55% @fontSettings -Class foreground-fill -Fill '#4488ff'
3436
) -OutputPath (Join-Path $assetsRoot .\4bitcss.svg)
3537

3638

@@ -47,9 +49,43 @@ $assetFile =
4749
640 - ((16 - $n - 1 ) * 40)
4850
)
4951
}
50-
) -OutputPath (Join-Path $docsRoot .\4bitpreview.svg) -Width 100%
52+
) -OutputPath (Join-Path $docsRoot .\4bitpreview.svg) -Width 320
53+
54+
$boxSize = [Ordered]@{Width = 80; Height = 80}
55+
=<svg> -ViewBox 640, 160 @(
56+
foreach ($n in 0..7) {
57+
=<svg.rect> -X ($boxSize.Width * $n) -Y 0 -Class "ansi$n-fill" @boxSize
58+
}
59+
foreach ($n in 8..15) {
60+
=<svg.rect> -X ($boxSize.Width * ($n - 8)) -Y 79 -Class "ansi$n-fill" @boxSize
61+
}
62+
) -OutputPath (Join-Path $docsRoot .\4bitpreview.svg) -Width 320
63+
64+
$colors = 'Black', 'Red', 'Green', 'Yellow', 'Blue', 'Purple', 'Cyan', 'White',
65+
'BrightBlack', 'BrightRed', 'BrightGreen', 'BrightYellow', 'BrightBlue', 'BrightPurple', 'BrightCyan', 'BrightWhite'
66+
67+
=<svg> -ViewBox 640, 240 @(
68+
=<svg.defs> @(
69+
=<svg.style> -Type 'text/css' @'
70+
@import url('https://4bitcss.com/$ColorSchemeFileName.css')
71+
'@
72+
=<svg.style> -Type 'text/css' @'
73+
@import url('https://fonts.googleapis.com/css?family=Abel')
74+
'@
75+
)
76+
=<svg.rect> -Width 640 -Height 80 -X 0 -Y 0 -Class 'background-fill'
77+
=<svg.text> -X 50% -Y 16.5% -Class 'foreground-fill' -Content @(
78+
'$ColorSchemeName'
79+
) @fontSettings
80+
foreach ($n in 0..7) {
81+
=<svg.rect> -X ($boxSize.Width * $n) -Y 79 -Class "ansi$n-fill" @boxSize -Fill $($colors[$n])
82+
}
83+
foreach ($n in 8..15) {
84+
=<svg.rect> -X ($boxSize.Width * ($n - 8)) -Y 159 -Class "ansi$n-fill" @boxSize -Fill $($colors[$n])
85+
}
86+
) -OutputPath (Join-Path $docsRoot .\4bitpreviewtemplate.svg) -Class background-fill
5187

5288
$assetFile
53-
$assetFile | Copy-Item -Destination (Join-Path $docsRoot .\4bitcss.svg) -PassThru
89+
$assetFile | Copy-Item -Destination (Join-Path $docsRoot .\4bitcss.svg)
5490

5591
Pop-Location

4bitcss.build.ps1

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,73 @@
1+
2+
# If running in a github workflow
13
if ($env:GITHUB_WORKSPACE) {
4+
# clone the iTermColorSchemes repo
25
git clone https://github.com/mbadolato/iTerm2-Color-Schemes.git | Out-Host
36

7+
# and get all of the JSON files from it
48
$jsonFiles = Get-ChildItem -Path iTerm2-Color-Schemes -Recurse -Filter *.json |
59
Where-Object Fullname -like '*terminal*' |
610
Select-Object -Skip 2
711
} else {
12+
# Otherwise get them locally
813
$jsonFiles = Get-ChildItem $home\documents\git\iTerm2-Color-Schemes -Recurse -Filter *.json |
914
Where-Object Fullname -like '*terminal*' |
1015
Select-Object -Skip 2
1116
}
1217

1318

19+
# Import the module
1420
Import-Module .\4bitcss.psd1 -Global
1521

22+
# Build the index file.
23+
$transpiledPreview = Build-PipeScript -InputPath .\docs\index.ps.markdown
24+
# (we'll slightly modify this for each preview)
25+
$transpiledText = [IO.File]::ReadAllText($transpiledPreview.FullName)
26+
27+
# Also, get the preview template.
28+
$previewSvg = (Get-ChildItem -Path docs -Filter 4bitpreviewtemplate.svg | Get-Content -raw)
29+
30+
# The ./docs directory is our destination for most file.
31+
32+
$docsPath = Join-Path $PSScriptRoot docs
33+
34+
# Walk thru each json file of a color scheme
1635
foreach ($jsonFile in $jsonFiles) {
36+
# convert the contents from JSON
1737
$jsonObject = [IO.File]::ReadAllText($jsonFile.FullName) | ConvertFrom-Json
18-
38+
# and determine the name of the scheme and it's files.
39+
$colorSchemeName = $jsonObject.Name
40+
$colorSchemeFileName = $jsonObject.Name -replace '\s'
41+
# If the name wasn't there, continue.
1942
if (-not $jsonObject.Name) { continue }
43+
# If it wasn't legal, continue.
2044
if ($jsonObject.Name -match '^\{') { continue }
45+
# Export the theme to /css (so that repo-based CDNs have a logical link)
2146
$jsonObject | Export-4BitCSS -OutputPath (Join-Path $PSScriptRoot css)
22-
$jsonObject | Export-4BitCSS -OutputPath (Join-Path $PSScriptRoot docs)
47+
# Then export it again to /docs (so the GitHub page works)
48+
$jsonObject | Export-4BitCSS -OutputPath $docsPath
49+
50+
# Create a preview file. All we need to change is the stylesheet.
51+
$previewFilePath = Join-Path $docsPath "$colorSchemeFileName.md"
52+
@"
53+
---
54+
stylesheet: $colorSchemeFileName.css
55+
image: $colorSchemeFileName.png
56+
description: $colorSchemeName color scheme
57+
---
58+
$transpiledText
59+
"@ |
60+
Set-Content $previewFilePath -Encoding utf8
61+
# output the file so that PipeScript will check it in.
62+
Get-Item -Path $previewFilePath
63+
64+
# Now create a preview SVG
65+
$previewSvgPath = Join-Path $docsPath "$colorSchemeFileName.svg"
66+
67+
# by expanding the string we have in $previewSVG (this will replace $ColorSchemeName)
68+
$executionContext.SessionState.InvokeCommand.ExpandString($previewSvg) |
69+
Set-Content -Path $previewSvgPath
70+
71+
# output the file so that PipeScript will check it in.
72+
Get-Item -Path $previewSvgPath
2373
}

4bitcss.psd1

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@{
2-
ModuleVersion = '0.1'
2+
ModuleVersion = '0.1.1'
33
RootModule = '4bitcss.psm1'
44
Description = 'CSS3 Color Schemes'
55
Guid = '93e1d6ab-ce88-4751-bb14-b21fbb9f66f3'
@@ -11,6 +11,19 @@
1111
ProjectURI = 'https://github.com/2bitdesigns'
1212
LicenseURI = 'https://github.com/2bitdesigns/4bitcss/blob/main/LICENSE'
1313
ReleaseNotes = @'
14+
## 0.1.1:
15+
16+
* Adding preview urls (e.g. https://4bitcss.com/Konsolas ) (Fixes #10)
17+
* Export-4BitCss:
18+
* Fixing ansi13-fill (Fixes #12)
19+
* Quoting color scheme name (Fixes #11)
20+
* Refactoring preview image (Fixes #9)
21+
* Adding /using (Fixes #8)
22+
* Site now supports OpenGraph (Fixes #13)
23+
* Adding analytics (Fixes #7)
24+
25+
---
26+
1427
## 0.1:
1528
1629
* Initial Release of 4bitcss

Assets/4bitcss.svg

Lines changed: 3 additions & 3 deletions
Loading

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## 0.1.1:
2+
3+
* Adding preview urls (e.g. https://4bitcss.com/Konsolas ) (Fixes #10)
4+
* Export-4BitCss:
5+
* Fixing ansi13-fill (Fixes #12)
6+
* Quoting color scheme name (Fixes #11)
7+
* Refactoring preview image (Fixes #9)
8+
* Adding /using (Fixes #8)
9+
* Site now supports OpenGraph (Fixes #13)
10+
* Adding analytics (Fixes #7)
11+
12+
---
13+
14+
## 0.1:
15+
16+
* Initial Release of 4bitcss
17+
* 295 Glorious 16 Color Schemes!

Export-4BitCSS.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,11 @@ function Export-4BitCSS
235235
:root {
236236
$(@(
237237
foreach ($prop in $jsonObject.psobject.properties) {
238-
"--$($prop.Name): $($prop.Value)"
238+
if ($prop.Name -eq 'Name') {
239+
"--$($prop.Name): '$($prop.Value)'"
240+
} else {
241+
"--$($prop.Name): $($prop.Value)"
242+
}
239243
}) -join (';' + [Environment]::NewLine + ' '))
240244
}
241245
@@ -328,7 +332,7 @@ if (-not $NoFill) {
328332
.brightgreen-fill , .bright-green-fill , .BrightGreenFill , .ANSI10-Fill, .ansi10-fill { fill: var(--brightGreen) }
329333
.brightyellow-fill , .bright-yellow-fill , .BrightYellowFill , .ANSI11-Fill, .ansi11-fill { fill: var(--brightYellow) }
330334
.brightblue-fill , .bright-blue-fill , .BrightBlueFill , .ANSI12-Fill, .ansi12-fill { fill: var(--brightBlue) }
331-
.brightmagneta-fill , .bright-magneta-fill , .BrightMagnetaFill , .ANSI13-Fill, .ansi13-fill { fill: var(--brightPuple) }
335+
.brightmagneta-fill , .bright-magneta-fill , .BrightMagnetaFill , .ANSI13-Fill, .ansi13-fill { fill: var(--brightPurple) }
332336
.brightpurple-fill , .bright-purple-fill, .BrightPurpleFill { fill: var(--brightPuple) }
333337
.brightcyan-fill , .bright-cyan-fill , .BrightCyanFill , .ANSI14-Fill, .ansi14-fill { fill: var(--brightCyan) }
334338
.brightwhite-fill , .bright-white-fill , .BrightWhiteFill , .ANSI15-Fill, .ansi15-fill { fill: var(--brightWhite) }

css/Abernathy.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
--green: #00cd00;
2020
--red: #cd0000;
2121
--black: #000000;
22-
--name: Abernathy
22+
--name: 'Abernathy'
2323
}
2424

2525
.colorSchemeName::before, .ColorSchemeName::before { content: 'Abernathy'; }
@@ -91,7 +91,7 @@
9191
.brightgreen-fill , .bright-green-fill , .BrightGreenFill , .ANSI10-Fill, .ansi10-fill { fill: var(--brightGreen) }
9292
.brightyellow-fill , .bright-yellow-fill , .BrightYellowFill , .ANSI11-Fill, .ansi11-fill { fill: var(--brightYellow) }
9393
.brightblue-fill , .bright-blue-fill , .BrightBlueFill , .ANSI12-Fill, .ansi12-fill { fill: var(--brightBlue) }
94-
.brightmagneta-fill , .bright-magneta-fill , .BrightMagnetaFill , .ANSI13-Fill, .ansi13-fill { fill: var(--brightPuple) }
94+
.brightmagneta-fill , .bright-magneta-fill , .BrightMagnetaFill , .ANSI13-Fill, .ansi13-fill { fill: var(--brightPurple) }
9595
.brightpurple-fill , .bright-purple-fill, .BrightPurpleFill { fill: var(--brightPuple) }
9696
.brightcyan-fill , .bright-cyan-fill , .BrightCyanFill , .ANSI14-Fill, .ansi14-fill { fill: var(--brightCyan) }
9797
.brightwhite-fill , .bright-white-fill , .BrightWhiteFill , .ANSI15-Fill, .ansi15-fill { fill: var(--brightWhite) }

css/Adventure.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
--green: #5da602;
2020
--red: #d84a33;
2121
--black: #040404;
22-
--name: Adventure
22+
--name: 'Adventure'
2323
}
2424

2525
.colorSchemeName::before, .ColorSchemeName::before { content: 'Adventure'; }
@@ -91,7 +91,7 @@
9191
.brightgreen-fill , .bright-green-fill , .BrightGreenFill , .ANSI10-Fill, .ansi10-fill { fill: var(--brightGreen) }
9292
.brightyellow-fill , .bright-yellow-fill , .BrightYellowFill , .ANSI11-Fill, .ansi11-fill { fill: var(--brightYellow) }
9393
.brightblue-fill , .bright-blue-fill , .BrightBlueFill , .ANSI12-Fill, .ansi12-fill { fill: var(--brightBlue) }
94-
.brightmagneta-fill , .bright-magneta-fill , .BrightMagnetaFill , .ANSI13-Fill, .ansi13-fill { fill: var(--brightPuple) }
94+
.brightmagneta-fill , .bright-magneta-fill , .BrightMagnetaFill , .ANSI13-Fill, .ansi13-fill { fill: var(--brightPurple) }
9595
.brightpurple-fill , .bright-purple-fill, .BrightPurpleFill { fill: var(--brightPuple) }
9696
.brightcyan-fill , .bright-cyan-fill , .BrightCyanFill , .ANSI14-Fill, .ansi14-fill { fill: var(--brightCyan) }
9797
.brightwhite-fill , .bright-white-fill , .BrightWhiteFill , .ANSI15-Fill, .ansi15-fill { fill: var(--brightWhite) }

css/AdventureTime.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
--green: #4ab118;
2020
--red: #bd0013;
2121
--black: #050404;
22-
--name: AdventureTime
22+
--name: 'AdventureTime'
2323
}
2424

2525
.colorSchemeName::before, .ColorSchemeName::before { content: 'AdventureTime'; }
@@ -91,7 +91,7 @@
9191
.brightgreen-fill , .bright-green-fill , .BrightGreenFill , .ANSI10-Fill, .ansi10-fill { fill: var(--brightGreen) }
9292
.brightyellow-fill , .bright-yellow-fill , .BrightYellowFill , .ANSI11-Fill, .ansi11-fill { fill: var(--brightYellow) }
9393
.brightblue-fill , .bright-blue-fill , .BrightBlueFill , .ANSI12-Fill, .ansi12-fill { fill: var(--brightBlue) }
94-
.brightmagneta-fill , .bright-magneta-fill , .BrightMagnetaFill , .ANSI13-Fill, .ansi13-fill { fill: var(--brightPuple) }
94+
.brightmagneta-fill , .bright-magneta-fill , .BrightMagnetaFill , .ANSI13-Fill, .ansi13-fill { fill: var(--brightPurple) }
9595
.brightpurple-fill , .bright-purple-fill, .BrightPurpleFill { fill: var(--brightPuple) }
9696
.brightcyan-fill , .bright-cyan-fill , .BrightCyanFill , .ANSI14-Fill, .ansi14-fill { fill: var(--brightCyan) }
9797
.brightwhite-fill , .bright-white-fill , .BrightWhiteFill , .ANSI15-Fill, .ansi15-fill { fill: var(--brightWhite) }

css/Afterglow.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
--green: #7e8e50;
2020
--red: #ac4142;
2121
--black: #151515;
22-
--name: Afterglow
22+
--name: 'Afterglow'
2323
}
2424

2525
.colorSchemeName::before, .ColorSchemeName::before { content: 'Afterglow'; }
@@ -91,7 +91,7 @@
9191
.brightgreen-fill , .bright-green-fill , .BrightGreenFill , .ANSI10-Fill, .ansi10-fill { fill: var(--brightGreen) }
9292
.brightyellow-fill , .bright-yellow-fill , .BrightYellowFill , .ANSI11-Fill, .ansi11-fill { fill: var(--brightYellow) }
9393
.brightblue-fill , .bright-blue-fill , .BrightBlueFill , .ANSI12-Fill, .ansi12-fill { fill: var(--brightBlue) }
94-
.brightmagneta-fill , .bright-magneta-fill , .BrightMagnetaFill , .ANSI13-Fill, .ansi13-fill { fill: var(--brightPuple) }
94+
.brightmagneta-fill , .bright-magneta-fill , .BrightMagnetaFill , .ANSI13-Fill, .ansi13-fill { fill: var(--brightPurple) }
9595
.brightpurple-fill , .bright-purple-fill, .BrightPurpleFill { fill: var(--brightPuple) }
9696
.brightcyan-fill , .bright-cyan-fill , .BrightCyanFill , .ANSI14-Fill, .ansi14-fill { fill: var(--brightCyan) }
9797
.brightwhite-fill , .bright-white-fill , .BrightWhiteFill , .ANSI15-Fill, .ansi15-fill { fill: var(--brightWhite) }

0 commit comments

Comments
 (0)