Skip to content

Commit

Permalink
fix(named colors): accent opacity (catppuccin#70)
Browse files Browse the repository at this point in the history
Fixes an issue where the opacity value would cause a crash when trying
to set opacity for "accent".

Closes catppuccin#69
  • Loading branch information
nekowinston authored Nov 2, 2022
1 parent 3f615c5 commit e524df8
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/theme/uiColors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CatppuccinWorkbenchMode, ThemeContext } from "../types";
import { opacity, transparent, shade } from "./utils";
import { opacity, shade, transparent } from "./utils";

const getWorkbenchColors = (context: ThemeContext) => {
const { palette, options } = context;
Expand Down Expand Up @@ -43,10 +43,17 @@ export const getUiColors = (context: ThemeContext) => {
})
.map(([k, v]) => {
// deal with accents
if (v === "accent") {
return {
[k]: accent,
};
if (v.startsWith("accent")) {
const entry = v.split(" ");
if (entry.length !== 1) {
return {
[k]: opacity(accent, Number(entry[1])),
};
} else {
return {
[k]: accent,
};
}
}

//check if the entry is a "color opacity" mapping
Expand Down

0 comments on commit e524df8

Please sign in to comment.