@blocklet/labels 2.3.21 → 2.3.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -787,7 +787,7 @@ const useSessionContext = () => {
787
787
  const getTextColor = (color, mode) => {
788
788
  const baseColor = chroma(color);
789
789
  if (mode === "dark") {
790
- return baseColor.luminance() > 0.5 ? baseColor.darken(3).hex() : baseColor.brighten(3).hex();
790
+ return baseColor.brighten(4).hex();
791
791
  }
792
792
  return baseColor.hex();
793
793
  };
@@ -804,7 +804,10 @@ const getBorderColor = (color, mode) => {
804
804
  const getBackgroundColor = (color, mode) => {
805
805
  const baseColor = chroma(color);
806
806
  if (mode === "dark") {
807
- return baseColor.brighten(2).alpha(0.25).hex();
807
+ if (baseColor.luminance() > 0.5) {
808
+ return baseColor.darken(2).alpha(0.5).hex();
809
+ }
810
+ return baseColor.brighten(1.5).alpha(0.35).hex();
808
811
  }
809
812
  if (baseColor.luminance() > 0.5) {
810
813
  return baseColor.darken(2.5).hex();
@@ -833,19 +836,20 @@ function LabelChip({
833
836
  const { getFullLabelName, getLabelName } = LabelsContainer.useContainer();
834
837
  const theme = useTheme();
835
838
  const { mode } = theme.palette;
839
+ const color = getTextColor(label.data.color, mode);
836
840
  const mergedSx = [
837
841
  {
838
842
  height: 20,
839
843
  borderRadius: 0.5,
840
844
  fontSize: 12,
841
845
  fontWeight: 500,
842
- color: `${getTextColor(label.data.color, mode)} !important`,
846
+ color: `${color} !important`,
843
847
  bgcolor: `${getBackgroundColor(label.data.color, mode)} !important`,
844
848
  transition: "filter 0.2s",
845
849
  borderColor: `${getBorderColor(label.data.color, mode)} !important`,
846
- WebkitTextFillColor: `${getTextColor(label.data.color, mode)} !important`,
850
+ WebkitTextFillColor: `${color} !important`,
847
851
  ".MuiChip-deleteIcon": {
848
- color: `${getTextColor(label.data.color, mode)} !important`,
852
+ color: `${color} !important`,
849
853
  cursor: "pointer",
850
854
  transition: "transform 0.3s",
851
855
  "&:hover": {
package/dist/index.umd.js CHANGED
@@ -774,7 +774,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
774
774
  const getTextColor = (color, mode) => {
775
775
  const baseColor = chroma(color);
776
776
  if (mode === "dark") {
777
- return baseColor.luminance() > 0.5 ? baseColor.darken(3).hex() : baseColor.brighten(3).hex();
777
+ return baseColor.brighten(4).hex();
778
778
  }
779
779
  return baseColor.hex();
780
780
  };
@@ -791,7 +791,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
791
791
  const getBackgroundColor = (color, mode) => {
792
792
  const baseColor = chroma(color);
793
793
  if (mode === "dark") {
794
- return baseColor.brighten(2).alpha(0.25).hex();
794
+ if (baseColor.luminance() > 0.5) {
795
+ return baseColor.darken(2).alpha(0.5).hex();
796
+ }
797
+ return baseColor.brighten(1.5).alpha(0.35).hex();
795
798
  }
796
799
  if (baseColor.luminance() > 0.5) {
797
800
  return baseColor.darken(2.5).hex();
@@ -820,19 +823,20 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
820
823
  const { getFullLabelName, getLabelName } = LabelsContainer.useContainer();
821
824
  const theme = material.useTheme();
822
825
  const { mode } = theme.palette;
826
+ const color = getTextColor(label.data.color, mode);
823
827
  const mergedSx = [
824
828
  {
825
829
  height: 20,
826
830
  borderRadius: 0.5,
827
831
  fontSize: 12,
828
832
  fontWeight: 500,
829
- color: `${getTextColor(label.data.color, mode)} !important`,
833
+ color: `${color} !important`,
830
834
  bgcolor: `${getBackgroundColor(label.data.color, mode)} !important`,
831
835
  transition: "filter 0.2s",
832
836
  borderColor: `${getBorderColor(label.data.color, mode)} !important`,
833
- WebkitTextFillColor: `${getTextColor(label.data.color, mode)} !important`,
837
+ WebkitTextFillColor: `${color} !important`,
834
838
  ".MuiChip-deleteIcon": {
835
- color: `${getTextColor(label.data.color, mode)} !important`,
839
+ color: `${color} !important`,
836
840
  cursor: "pointer",
837
841
  transition: "transform 0.3s",
838
842
  "&:hover": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/labels",
3
- "version": "2.3.21",
3
+ "version": "2.3.22",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -29,7 +29,7 @@
29
29
  "react-color": "^2.19.3",
30
30
  "react-select": "^5.8.1",
31
31
  "unstated-next": "^1.1.0",
32
- "@blocklet/translation-input": "^2.3.21"
32
+ "@blocklet/translation-input": "^2.3.22"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@arcblock/did-connect": "^2.10.36",