Browse Source

fix(nc-gui): base icon predefined color lightness issue

pull/7807/head
Ramesh Mane 7 months ago
parent
commit
95507c1896
  1. 2
      packages/nc-gui/components/general/BaseIconColorPicker.vue
  2. 32
      packages/nc-gui/components/general/ProjectIcon.vue

2
packages/nc-gui/components/general/BaseIconColorPicker.vue

@ -1,7 +1,7 @@
<script lang="ts" setup>
import tinycolor from 'tinycolor2'
import { NcProjectType } from '#imports'
import { NcProjectType, baseIconColors } from '#imports'
const props = withDefaults(
defineProps<{

32
packages/nc-gui/components/general/ProjectIcon.vue

@ -1,24 +1,28 @@
<script lang="ts" setup>
import tinycolor from 'tinycolor2'
const { hoverable, color } = defineProps<{
type?: string
hoverable?: boolean
color?: string
}>()
import { baseIconColors } from '#imports'
const props = withDefaults(
defineProps<{
type?: string
hoverable?: boolean
color?: string
}>(),
{
color: baseIconColors[0],
},
)
const { color } = toRefs(props)
const iconColor = computed(() => {
return color
return color.value && tinycolor(color.value).isValid()
? {
tint: tinycolor(color || '#36BFFF')
.lighten(10)
.toHexString(),
shade: tinycolor(color || '#36BFFF')
.darken(40)
.toHexString(),
tint: baseIconColors.includes(color.value) ? color.value : tinycolor(color.value).lighten(10).toHexString(),
shade: tinycolor(color.value).darken(40).toHexString(),
}
: {
tint: '#36BFFF',
shade: '#142966',
tint: baseIconColors[0],
shade: tinycolor(baseIconColors[0]).darken(40).toHexString(),
}
})
</script>

Loading…
Cancel
Save