Skip to content

Commit 87315bc

Browse files
committed
chore(format): fixed new palette naming & run stylua
1 parent 468fffc commit 87315bc

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

lua/github-theme/lib/color.lua

+22-4
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,12 @@ function Color.from_hex(c)
125125
end
126126
end
127127

128-
return Color.init(bit.rshift(n, 24) / 0xff, bit.band(bit.rshift(n, 16), 0xff) / 0xff, bit.band(bit.rshift(n, 8), 0xff) / 0xff, bit.band(n, 0xff) / 0xff)
128+
return Color.init(
129+
bit.rshift(n, 24) / 0xff,
130+
bit.band(bit.rshift(n, 16), 0xff) / 0xff,
131+
bit.band(bit.rshift(n, 8), 0xff) / 0xff,
132+
bit.band(n, 0xff) / 0xff
133+
)
129134
end
130135

131136
---Create a Color from HSV value
@@ -217,7 +222,10 @@ end
217222
---@return integer
218223
function Color:to_hex(with_alpha)
219224
local ls, bor, fl = bit.lshift, bit.bor, math.floor
220-
local n = bor(bor(ls(fl((self.red * 0xff) + 0.5), 16), ls(fl((self.green * 0xff) + 0.5), 8)), fl((self.blue * 0xff) + 0.5))
225+
local n = bor(
226+
bor(ls(fl((self.red * 0xff) + 0.5), 16), ls(fl((self.green * 0xff) + 0.5), 8)),
227+
fl((self.blue * 0xff) + 0.5)
228+
)
221229
return with_alpha and bit.lshift(n, 8) + (self.alpha * 0xff) or n
222230
end
223231

@@ -251,7 +259,12 @@ end
251259
---@param f number Float [0,1]. 0 being this and 1 being other
252260
---@return Color
253261
function Color:blend(other, f)
254-
return Color.init((other.red - self.red) * f + self.red, (other.green - self.green) * f + self.green, (other.blue - self.blue) * f + self.blue, self.alpha)
262+
return Color.init(
263+
(other.red - self.red) * f + self.red,
264+
(other.green - self.green) * f + self.green,
265+
(other.blue - self.blue) * f + self.blue,
266+
self.alpha
267+
)
255268
end
256269

257270
---Returns a new shaded color.
@@ -261,7 +274,12 @@ function Color:shade(f)
261274
local t = f < 0 and 0 or 1.0
262275
local p = f < 0 and f * -1.0 or f
263276

264-
return Color.init((t - self.red) * p + self.red, (t - self.green) * p + self.green, (t - self.blue) * p + self.blue, self.alpha)
277+
return Color.init(
278+
(t - self.red) * p + self.red,
279+
(t - self.green) * p + self.green,
280+
(t - self.blue) * p + self.blue,
281+
self.alpha
282+
)
265283
end
266284

267285
---Adds value of `v` to the `value` of the current color. This returns either

0 commit comments

Comments
 (0)