light.ts 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. import { cbh, cdh, cah, cmh } from '@/utils/chromaHelper'
  2. import twc from '@/utils/tailwindColor'
  3. import type { GlobalThemeOverrides } from 'naive-ui'
  4. const LIGHT = {
  5. textColorBase: twc.neutral[800],
  6. textColor1: twc.neutral[750],
  7. textColor2: twc.neutral[700],
  8. textColor3: twc.neutral[500],
  9. borderColor: twc.neutral[150],
  10. }
  11. const closeIconColor = (primaryColor: string) => {
  12. return {
  13. closeIconColorSuccess: twc.lime[500],
  14. closeIconColorInfo: twc.sky[500],
  15. closeIconColorWarning: twc.amber[500],
  16. closeIconColorError: twc.pink[500],
  17. closeIconColorLoading: primaryColor,
  18. closeColorHoverSuccess: cah(twc.lime[400], 0.14),
  19. closeIconColorHoverSuccess: cdh(twc.lime[500], 0.2),
  20. closeColorPressedSuccess: cah(twc.lime[400], 0.2),
  21. closeIconColorPressedSuccess: cdh(twc.lime[500], 0.6),
  22. closeColorHoverInfo: cah(twc.sky[400], 0.14),
  23. closeIconColorHoverInfo: cdh(twc.sky[500], 0.2),
  24. closeColorPressedInfo: cah(twc.sky[400], 0.2),
  25. closeIconColorPressedInfo: cdh(twc.sky[500], 0.6),
  26. closeColorHoverWarning: cah(twc.amber[400], 0.14),
  27. closeIconColorHoverWarning: cdh(twc.amber[500], 0.2),
  28. closeColorPressedWarning: cah(twc.amber[400], 0.2),
  29. closeIconColorPressedWarning: cdh(twc.amber[500], 0.6),
  30. closeColorHoverError: cah(twc.pink[400], 0.14),
  31. closeIconColorHoverError: cdh(twc.pink[500], 0.2),
  32. closeColorPressedError: cah(twc.pink[400], 0.2),
  33. closeIconColorPressedError: cdh(twc.pink[500], 0.6),
  34. closeColorHoverLoading: cah(primaryColor, 0.14),
  35. closeIconColorHoverLoading: cdh(primaryColor, 0.2),
  36. closeColorPressedLoading: cah(primaryColor, 0.2),
  37. closeIconColorPressedLoading: cdh(primaryColor, 0.6),
  38. } as const
  39. }
  40. export function baseLightThemeOverrides(primaryColor = ''): GlobalThemeOverrides {
  41. return {
  42. common: {
  43. textColorBase: LIGHT.textColorBase,
  44. textColor1: LIGHT.textColor1,
  45. textColor2: LIGHT.textColor2,
  46. textColor3: LIGHT.textColor3,
  47. bodyColor: twc.neutral[25],
  48. borderColor: LIGHT.borderColor,
  49. cardColor: twc.neutral[25],
  50. hoverColor: twc.neutral[150],
  51. modalColor: twc.neutral[100],
  52. popoverColor: twc.neutral[25],
  53. scrollbarColor: twc.neutral[200],
  54. scrollbarColorHover: twc.neutral[250],
  55. closeIconColor: cbh(twc.neutral[500], 0.2),
  56. closeColorHover: cah(twc.neutral[500], 0.1),
  57. closeIconColorPressed: twc.neutral[500],
  58. closeColorPressed: cah(twc.neutral[500], 0.14),
  59. infoColor: twc.sky[500],
  60. infoColorHover: cdh(twc.sky[500], 0.1),
  61. infoColorPressed: cdh(twc.sky[500], 0.2),
  62. infoColorSuppl: twc.sky[500],
  63. successColor: twc.lime[500],
  64. successColorHover: cdh(twc.lime[500], 0.1),
  65. successColorPressed: cdh(twc.lime[500], 0.2),
  66. successColorSuppl: twc.lime[500],
  67. warningColor: twc.amber[500],
  68. warningColorHover: cdh(twc.amber[500], 0.1),
  69. warningColorPressed: cdh(twc.amber[500], 0.2),
  70. warningColorSuppl: twc.amber[500],
  71. errorColor: twc.pink[500],
  72. errorColorHover: cdh(twc.pink[500], 0.1),
  73. errorColorPressed: cdh(twc.pink[500], 0.2),
  74. errorColorSuppl: twc.pink[500],
  75. },
  76. Alert: {
  77. ...closeIconColor(primaryColor),
  78. },
  79. Button: {
  80. textColorSuccess: twc.lime[25],
  81. textColorInfo: twc.sky[25],
  82. textColorWarning: twc.amber[25],
  83. textColorError: twc.pink[25],
  84. },
  85. Card: {
  86. borderColor: LIGHT.borderColor,
  87. },
  88. Checkbox: {
  89. common: {
  90. borderColor: twc.neutral[250],
  91. },
  92. colorDisabled: twc.neutral[100],
  93. },
  94. DataTable: {
  95. borderColor: LIGHT.borderColor,
  96. tdColor: twc.neutral[25],
  97. tdColorHover: cdh(twc.neutral[100], 0.06),
  98. thColor: twc.neutral[100],
  99. },
  100. Divider: {
  101. color: twc.neutral[150],
  102. },
  103. Drawer: {
  104. footerBorderTop: `1px solid ${LIGHT.borderColor}`,
  105. headerBorderBottom: `1px solid ${LIGHT.borderColor}`,
  106. peers: {
  107. Scrollbar: {
  108. color: twc.neutral[300],
  109. colorHover: twc.neutral[350],
  110. },
  111. },
  112. },
  113. Message: {
  114. textColorSuccess: twc.lime[500],
  115. textColorInfo: twc.sky[500],
  116. textColorWarning: twc.amber[500],
  117. textColorError: twc.pink[500],
  118. textColorLoading: primaryColor,
  119. colorSuccess: cbh(twc.lime[25], 0.3),
  120. colorInfo: cbh(twc.sky[25], 0.3),
  121. colorWarning: cbh(twc.amber[25], 0.3),
  122. colorError: cbh(twc.pink[25], 0.3),
  123. colorLoading: cmh(twc.neutral[25], primaryColor, 0.01),
  124. ...closeIconColor(primaryColor),
  125. },
  126. Modal: {
  127. peers: {
  128. Scrollbar: {
  129. color: twc.neutral[350],
  130. colorHover: twc.neutral[300],
  131. },
  132. },
  133. },
  134. Notification: {
  135. peers: {
  136. Scrollbar: {
  137. color: twc.neutral[350],
  138. colorHover: twc.neutral[400],
  139. },
  140. },
  141. },
  142. Popover: {
  143. color: twc.neutral[25],
  144. textColor: LIGHT.textColor2,
  145. },
  146. Radio: {
  147. common: {
  148. borderColor: twc.neutral[250],
  149. },
  150. },
  151. Select: {
  152. peers: {
  153. InternalSelectMenu: {
  154. actionDividerColor: twc.neutral[200],
  155. peers: {
  156. Scrollbar: {
  157. color: twc.neutral[150],
  158. colorHover: twc.neutral[200],
  159. },
  160. },
  161. },
  162. },
  163. },
  164. Slider: {
  165. indicatorColor: twc.neutral[25],
  166. indicatorTextColor: LIGHT.textColor2,
  167. },
  168. Upload: {
  169. draggerColor: twc.neutral[100],
  170. },
  171. }
  172. }