LCOV - code coverage report
Current view: top level - src/renderer/extensions/vueNodes/utils - nodeStyleUtils.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 91.7 % 12 11
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import { RenderShape } from '@comfyorg/graph-model/globalEnums'
       2              : import { useThemeStore } from '@/platform/theme/themeStore'
       3              : import { adjustColor } from '@comfyorg/shared-frontend-utils/colorUtil'
       4              : 
       5              : /** Lightness litegraph applies to node colors in a light color scheme. */
       6         2356 : export const LIGHT_THEME_NODE_LIGHTNESS = 0.5
       7              : 
       8              : /** Lightens a node color the way a light color scheme renders it. */
       9        71981 : export function toLightThemeNodeColor(color: string): string {
      10        71981 :   return adjustColor(color, { lightness: LIGHT_THEME_NODE_LIGHTNESS })
      11              : }
      12              : 
      13              : /** Lightens a node color only when the active palette is light. */
      14        71507 : export function applyLightThemeColor(color?: string): string {
      15        71507 :   if (!color) return ''
      16              : 
      17          874 :   if (useThemeStore().colorScheme !== 'light') return color
      18              : 
      19           75 :   return toLightThemeNodeColor(color)
      20              : }
      21              : 
      22              : export interface ShapeClassVariants {
      23              :   readonly box: string
      24              :   readonly card: string
      25              :   readonly default: string
      26              : }
      27              : 
      28              : /**
      29              :  * Picks the class variant matching a node's render shape, treating every
      30              :  * shape other than BOX and CARD as the default rounding.
      31              :  */
      32        25485 : export function shapeVariantClass(
      33              :   shape: RenderShape | undefined,
      34              :   variants: ShapeClassVariants
      35              : ): string {
      36        25485 :   switch (shape) {
      37              :     case RenderShape.BOX:
      38            3 :       return variants.box
      39              :     case RenderShape.CARD:
      40            0 :       return variants.card
      41              :     default:
      42        25482 :       return variants.default
      43              :   }
      44              : }
        

Generated by: LCOV version 2.0-1