Skip to content

Commit 4df7555

Browse files
committed
🎨 [style] Standardize PowerShell script formatting
Updates PowerShell scripts for consistent formatting and readability. - 🎨 [style] Improves code appearance: - βœ… Introduces spaces around operators (e.g., `$i=0` to `$i = 0`) for enhanced clarity. - βž– Avoids redundant negation of planet radius - βž— Improves readability of math operators - 🚜 [refactor] Streamlines code structure: - ✨ Eliminates unnecessary parenthesis and improves overall script appearance. - πŸ› οΈ [fix] Minor fixes: - πŸ› Fixes a typo in the `complex-lissajous.ps1` script, changing `Count = 0` to `Count = 0` to improve readability. - πŸ“ [docs] Updates file path references: - πŸ“‚ Modifies script paths to align with the project's directory structure, ensuring accurate references. Signed-off-by: Nick2bad4u <20943337+Nick2bad4u@users.noreply.github.com>
1 parent 92fd605 commit 4df7555

27 files changed

Lines changed: 155 additions & 153 deletions

β€ŽColorScripts-Enhanced/Scripts/Galaxy.ps1β€Ž

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ $w = 100
66
$h = 12
77
$stars = 140
88
$grid = @()
9-
for ($i=0; $i -lt $h; $i++) { $grid += , (@(" " * $w).ToCharArray()) }
9+
for ($i = 0; $i -lt $h; $i++) { $grid += , (@(" " * $w).ToCharArray()) }
1010

11-
for ($s=0; $s -lt $stars; $s++) {
11+
for ($s = 0; $s -lt $stars; $s++) {
1212
$x = Get-Random -Minimum 0 -Maximum $w
1313
$y = Get-Random -Minimum 0 -Maximum $h
1414
$depth = Get-Random
@@ -23,9 +23,9 @@ $planetY = [int]($h / 2)
2323
$planetRadius = 5
2424
$planetCoreChar = "●"
2525
$planetEdgeChar = "β—‰"
26-
for ($py = -$planetRadius; $py -le $planetRadius; $py++) {
27-
for ($px = -$planetRadius; $px -le $planetRadius; $px++) {
28-
$dist = [math]::Sqrt($px*$px + $py*$py)
26+
for ($py = - $planetRadius; $py -le $planetRadius; $py++) {
27+
for ($px = - $planetRadius; $px -le $planetRadius; $px++) {
28+
$dist = [math]::Sqrt($px * $px + $py * $py)
2929
if ($dist -le $planetRadius) {
3030
$drawX = $planetX + $px
3131
$drawY = $planetY + $py
@@ -41,9 +41,9 @@ for ($py = -$planetRadius; $py -le $planetRadius; $py++) {
4141
}
4242
}
4343

44-
for ($row=0; $row -lt $h; $row++) {
44+
for ($row = 0; $row -lt $h; $row++) {
4545
$line = New-Object System.Text.StringBuilder
46-
for ($col=0; $col -lt $w; $col++) {
46+
for ($col = 0; $col -lt $w; $col++) {
4747
$ch = $grid[$row][$col]
4848
switch ($ch) {
4949
"." { $color = "245;245;255" }

β€ŽColorScripts-Enhanced/Scripts/Gradient-Tiles.ps1β€Ž

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
$esc = [char]27
55
$rows = 8
66
$cols = 100
7-
for ($y=0; $y -lt $rows; $y++) {
7+
for ($y = 0; $y -lt $rows; $y++) {
88
$line = New-Object System.Text.StringBuilder
9-
for ($x=0; $x -lt $cols; $x++) {
10-
$r = [int](30 + 225 * ($x / ($cols-1)))
11-
$g = [int](30 + 225 * ($y / ($rows-1)))
12-
$b = [int](30 + 225 * ((($x+$y)/($cols+$rows-2))))
9+
for ($x = 0; $x -lt $cols; $x++) {
10+
$r = [int](30 + 225 * ($x / ($cols - 1)))
11+
$g = [int](30 + 225 * ($y / ($rows - 1)))
12+
$b = [int](30 + 225 * ((($x + $y) / ($cols + $rows - 2))))
1313
$null = $line.Append("$esc[48;2;$r;$g;$b" + "m ")
1414
}
1515
$null = $line.Append("$esc[0m")

β€ŽColorScripts-Enhanced/Scripts/RGB-Wave-Shifted.ps1β€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ $esc = [char]27
66
function New-Gradient {
77
param([int]$Width = 72, [int]$Phase = 0)
88
$sb = New-Object System.Text.StringBuilder
9-
for ($i=0; $i -lt $Width; $i++) {
9+
for ($i = 0; $i -lt $Width; $i++) {
1010
$r = [math]::Round(128 + 127 * [math]::Sin( ($i + $Phase) * 0.09 ))
1111
$g = [math]::Round(128 + 127 * [math]::Sin( ($i + $Phase) * 0.09 + 2.094 ))
1212
$b = [math]::Round(128 + 127 * [math]::Sin( ($i + $Phase) * 0.09 + 4.188 ))

β€ŽColorScripts-Enhanced/Scripts/RGB-Wave.ps1β€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ $esc = [char]27
66
function New-Gradient {
77
param([int]$Width = 72, [int]$Phase = 0)
88
$sb = New-Object System.Text.StringBuilder
9-
for ($i=0; $i -lt $Width; $i++) {
9+
for ($i = 0; $i -lt $Width; $i++) {
1010
$r = [math]::Round(128 + 127 * [math]::Sin( ($i + $Phase) * 0.09 ))
1111
$g = [math]::Round(128 + 127 * [math]::Sin( ($i + $Phase) * 0.09 + 2.094 ))
1212
$b = [math]::Round(128 + 127 * [math]::Sin( ($i + $Phase) * 0.09 + 4.188 ))

β€ŽColorScripts-Enhanced/Scripts/aurora-bands.ps1β€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Write-Host
99
for ($y = 0; $y -lt $rows; $y++) {
1010
$sb = [System.Text.StringBuilder]::new()
1111
for ($x = 0; $x -lt $cols; $x++) {
12-
$t = $x / [double]([math]::Max($cols-1, 1))
12+
$t = $x / [double]([math]::Max($cols - 1, 1))
1313
$phase = $t * 6.28318530718
1414
$r = [int](120 + 120 * [math]::Sin($phase))
1515
$g = [int](120 + 120 * [math]::Sin($phase + 2.3))

β€ŽColorScripts-Enhanced/Scripts/bars.ps1β€Ž

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
$esc = [char]27
22

3-
$f1="$esc[30m"
4-
$f2="$esc[31m"
5-
$f3="$esc[32m"
6-
$f4="$esc[33m"
7-
$f5="$esc[34m"
8-
$f6="$esc[35m"
3+
$f1 = "$esc[30m"
4+
$f2 = "$esc[31m"
5+
$f3 = "$esc[32m"
6+
$f4 = "$esc[33m"
7+
$f5 = "$esc[34m"
8+
$f6 = "$esc[35m"
99

10-
$fbright1="$esc[90m"
11-
$fbright2="$esc[91m"
12-
$fbright3="$esc[92m"
13-
$fbright4="$esc[93m"
14-
$fbright5="$esc[94m"
15-
$fbright6="$esc[95m"
10+
$fbright1 = "$esc[90m"
11+
$fbright2 = "$esc[91m"
12+
$fbright3 = "$esc[92m"
13+
$fbright4 = "$esc[93m"
14+
$fbright5 = "$esc[94m"
15+
$fbright6 = "$esc[95m"
1616

17-
$bld="$esc[1m"
18-
$rst="$esc[0m"
17+
$bld = "$esc[1m"
18+
$rst = "$esc[0m"
1919

2020
Write-Host @"
2121

β€ŽColorScripts-Enhanced/Scripts/blocks1.ps1β€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
$esc = [char]27
22

33
function pcs {
4-
for ($i=0; $i -le 7; $i++) {
4+
for ($i = 0; $i -le 7; $i++) {
55
Write-Host "$esc[3$($i)mβ–ˆβ–ˆ $esc[0m" -NoNewline
66
}
77
Write-Host ""
88
}
99

1010
function pcsbright {
11-
for ($i=0; $i -le 7; $i++) {
11+
for ($i = 0; $i -le 7; $i++) {
1212
Write-Host "$esc[9$($i)mβ–ˆβ–ˆ $esc[0m" -NoNewline
1313
}
1414
Write-Host ""

β€ŽColorScripts-Enhanced/Scripts/complex-lissajous.ps1β€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ foreach ($harmonic in $harmonics) {
6464

6565
if (-not $grid.ContainsKey($key)) {
6666
$grid[$key] = @{
67-
Count = 0
68-
Hues = @()
67+
Count = 0
68+
Hues = @()
6969
Harmonics = @()
70-
Progress = $progress
70+
Progress = $progress
7171
}
7272
}
7373

β€ŽColorScripts-Enhanced/Scripts/dna.ps1β€Ž

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
$esc = [char]27
22

3-
$f1="$esc[30m"
4-
$f2="$esc[31m"
5-
$f3="$esc[32m"
6-
$f4="$esc[33m"
7-
$f5="$esc[34m"
8-
$f6="$esc[35m"
3+
$f1 = "$esc[30m"
4+
$f2 = "$esc[31m"
5+
$f3 = "$esc[32m"
6+
$f4 = "$esc[33m"
7+
$f5 = "$esc[34m"
8+
$f6 = "$esc[35m"
99

10-
$fbright1="$esc[90m"
11-
$fbright2="$esc[91m"
12-
$fbright3="$esc[92m"
13-
$fbright4="$esc[93m"
14-
$fbright5="$esc[94m"
15-
$fbright6="$esc[95m"
10+
$fbright1 = "$esc[90m"
11+
$fbright2 = "$esc[91m"
12+
$fbright3 = "$esc[92m"
13+
$fbright4 = "$esc[93m"
14+
$fbright5 = "$esc[94m"
15+
$fbright6 = "$esc[95m"
1616

17-
$bld="$esc[1m"
18-
$rst="$esc[0m"
17+
$bld = "$esc[1m"
18+
$rst = "$esc[0m"
1919

2020
Write-Host @"
2121

β€ŽColorScripts-Enhanced/Scripts/doom-original.ps1β€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
$esc = [char]27
2-
$boldon="$esc[1m"
3-
$reset="$esc[0m"
2+
$boldon = "$esc[1m"
3+
$reset = "$esc[0m"
44

55
Write-Host @"
66

0 commit comments

Comments
Β (0)