Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/pages/popup/components/Percentage/chart.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createTab } from "@api/chrome/tab"
import { getPrimaryTextColor, getSecondaryTextColor } from "@pages/util/style"
import { getCssVariable, getPrimaryTextColor, getSecondaryTextColor } from "@pages/util/style"
import { calJumpUrl } from "@popup/common"
import { t } from "@popup/locale"
import { sum } from "@util/array"
Expand Down Expand Up @@ -103,7 +103,8 @@ export function generateToolboxOption(): ToolboxComponentOption {
// file name
name: 'Time_Tracker_Percentage',
excludeComponents: ['toolbox'],
pixelRatio: 1
pixelRatio: 7,
backgroundColor: getCssVariable('--el-card-bg-color', '.el-card'),
},
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/pages/util/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ export const getStyle = (
}
}

export function getCssVariable(varName: string, ele?: HTMLElement): string | undefined {
const realEle = ele || document.documentElement
export function getCssVariable(varName: string, eleOrSelector?: HTMLElement | string): string | undefined {
const ele = typeof eleOrSelector === 'string' ? document.querySelector(eleOrSelector) : eleOrSelector
const realEle = ele ?? document.documentElement
if (!realEle) {
return undefined
}
return getComputedStyle(ele || document.documentElement).getPropertyValue(varName)
return getComputedStyle(realEle).getPropertyValue(varName)
}

export function getPrimaryTextColor(): string | undefined {
Expand Down