Browse Source

fix(nc-gui): PR review changes #2238

pull/7526/head
Ramesh Mane 11 months ago
parent
commit
8193b6f638
  1. 4
      packages/nc-gui/components/smartsheet/grid/Table.vue
  2. 4
      packages/nc-gui/utils/colorsUtils.ts

4
packages/nc-gui/components/smartsheet/grid/Table.vue

@ -25,8 +25,8 @@ import {
NavigateDir,
ReadonlyInj,
computed,
enumColor,
extractPkFromRow,
getEnumColorByIndex,
iconMap,
inject,
isColumnRequiredAndNull,
@ -1566,7 +1566,7 @@ onKeyStroke('ArrowDown', onDown)
v-e="['c:expanded-form:open']"
class="py-1 px-3 rounded-full text-xs cursor-pointer select-none transform hover:(scale-110)"
:style="{
backgroundColor: enumColor.light[row.rowMeta.commentCount % enumColor.light.length],
backgroundColor: getEnumColorByIndex(row.rowMeta.commentCount || 0),
}"
@click="expandAndLooseFocus(row, state)"
>

4
packages/nc-gui/utils/colorsUtils.ts

@ -235,3 +235,7 @@ export function isColorDark(hexColor: string) {
// Choose a luminance threshold (e.g., 0.5) to determine darkness/lightness
return luminance < 128
}
export function getEnumColorByIndex(i: number, mode: 'light' | 'dark' = 'light') {
return enumColor[mode][i % enumColor[mode].length]
}

Loading…
Cancel
Save