mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-02 11:40:00 +00:00
Enable ts-strict for colorUtil, contextMenuFilter and linkRenderMode (#1313)
* Add types for colorUtil.ts * Add types for contextMenuFilter * Add types to linkRenderMode.ts
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
// @ts-strict-ignore
|
||||
import { memoize } from 'lodash'
|
||||
|
||||
type RGB = { r: number; g: number; b: number }
|
||||
@@ -17,12 +16,11 @@ function rgbToHsl({ r, g, b }: RGB): HSL {
|
||||
b /= 255
|
||||
const max = Math.max(r, g, b),
|
||||
min = Math.min(r, g, b)
|
||||
let h: number, s: number
|
||||
let h = 0,
|
||||
s = 0
|
||||
const l: number = (max + min) / 2
|
||||
|
||||
if (max === min) {
|
||||
h = s = 0 // achromatic
|
||||
} else {
|
||||
if (max !== min) {
|
||||
const d = max - min
|
||||
s = l > 0.5 ? d / (2 - max - min) : d / (max + min)
|
||||
switch (max) {
|
||||
|
||||
Reference in New Issue
Block a user