Implement gray scale

This commit is contained in:
jordan4ibanez 2023-11-20 03:18:08 -05:00
parent 3157e912f1
commit 81c39a71c4
4 changed files with 33 additions and 7 deletions

View File

@ -14,7 +14,7 @@ do
local BGColor = formSpec.BGColor
local List = formSpec.List
local color = utility.color
print(color(1, 2, 3))
local colorScalar = utility.colorScalar
local playerInventory = generate(__TS__New(
FormSpec,
{
@ -23,9 +23,9 @@ do
__TS__New(
BGColor,
{
bgColor = color(100, 100, 100),
bgColor = colorScalar(85),
fullScreen = "both",
fullScreenbgColor = color(0, 0, 0, 20)
fullScreenbgColor = colorScalar(0, 20)
}
),
__TS__New(

View File

@ -7,16 +7,15 @@ namespace player {
const BGColor = formSpec.BGColor
const List = formSpec.List
const color = utility.color
print(color(1,2,3))
const colorScalar = utility.colorScalar
const playerInventory: string = generate(new FormSpec({
size: create(12,12),
elements: [
new BGColor({
bgColor: color(80,80,80),
bgColor: colorScalar(85),
fullScreen: "both",
fullScreenbgColor: color(0,0,0,20)
fullScreenbgColor: colorScalar(0,20)
}),
//! Craft area.
new List({

View File

@ -123,4 +123,19 @@ do
end
return newColor
end
function utility.colorScalar(s, a)
local newColor = "#"
local hex = hexValues[lockChannel(s)]
do
local i = 0
while i < 3 do
newColor = newColor .. hex
i = i + 1
end
end
if a then
newColor = newColor .. hexValues[lockChannel(a)]
end
return newColor
end
end

View File

@ -130,4 +130,16 @@ namespace utility {
return newColor
}
export function colorScalar(s: number, a?: number): string {
let newColor = "#"
const hex = hexValues[lockChannel(s)]
for (let i = 0; i < 3; i++) {
newColor += hex
}
if (a) {
newColor += hexValues[lockChannel(a)]
}
return newColor
}
}