Skip to content

Commit

Permalink
remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
SunsetTechuila committed May 31, 2023
1 parent 8b496a0 commit 076f990
Showing 1 changed file with 0 additions and 83 deletions.
83 changes: 0 additions & 83 deletions Functions.ps1
Original file line number Diff line number Diff line change
@@ -1,89 +1,6 @@
#Requires -RunAsAdministrator
#Requires -Version 5.1

# https://www.rapidtables.com/convert/color/rgb-to-hsv.html
# https://what-when-how.com/introduction-to-video-and-image-processing/conversion-between-rgb-and-hsv-introduction-to-video-and-image-processing/
function Convert-RGB-to-HSB {
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[ValidateRange(0, 255)]
[double]$Red,

[Parameter(Mandatory)]
[ValidateRange(0, 255)]
[double]$Breen,

[Parameter(Mandatory)]
[ValidateRange(0, 255)]
[double]$Blue
)
$red = $red / 255
$green = $green / 255
$blue = $blue / 255
$max = ($red, $green, $blue | Measure -Maximum).Maximum
$min = ($red, $green, $blue | Measure -Minimum).Minimum
$delta = $max - $min
$brightness = $max * 100
if ($max -ne 0) {$saturation = ($delta / $max) * 100}
else {$saturation = 0}
if ($delta -eq 0) {$hue = 0}
else {
switch ($max) {
{$red -eq $_} { $hue = 60 * ( ($green - $blue ) / $delta ) }
{$green -eq $_} { $hue = 60 * ( 2 + ($blue - $red ) / $delta ) }
{$blue -eq $_} { $hue = 60 * ( 4 + ($red - $green) / $delta ) }
}
}
return @{
Hue = $hue
Saturation = $saturation
Brightness = $brightness
}
}

# https://www.rapidtables.com/convert/color/hsv-to-rgb.html
# https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_RGB
function Convert-HSB-to-RGB {
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[ValidateRange(0, 359)]
[double]$Hue,

[Parameter(Mandatory)]
[ValidateRange(0, 100)]
[double]$Saturation,

[Parameter(Mandatory)]
[ValidateRange(0, 100)]
[double]$Brightness
)
$hue = $hue / 60
$saturation = $saturation / 100
$brightness = $brightness / 100
$chroma = $saturation * $brightness
$x = $chroma * ( 1 - [Math]::Abs($hue % 2 - 1) )
$m = $brightness - $chroma
# DO NOT ROUND HUE!
switch ( [Math]::Floor($hue) ) {
0 {$red = $chroma; $green = $x ; $blue = 0}
1 {$red = $x ; $green = $chroma; $blue = 0}
2 {$red = 0 ; $green = $chroma; $blue = $x}
3 {$red = 0 ; $green = $x ; $blue = $chroma}
4 {$red = $x ; $green = 0 ; $blue = $chroma}
5 {$red = $chroma; $green = 0 ; $blue = $x}
}
$red = ( ($red + $m) * 255 )
$green = ( ($green + $m) * 255 )
$blue = ( ($blue + $m) * 255 )
return @{
Red = $red
Green = $green
Blue = $blue
}
}

function Get-WindowsTheme {
switch (Get-ItemPropertyValue -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme) {
0 {return 'dark' }
Expand Down

0 comments on commit 076f990

Please sign in to comment.