Skip to content

feat: support to get the mode(dark or light) of the current color theme#641

Merged
wewoor merged 1 commit intomainfrom
feat/themeMode
Jan 27, 2022
Merged

feat: support to get the mode(dark or light) of the current color theme#641
wewoor merged 1 commit intomainfrom
feat/themeMode

Conversation

@kiwiwong
Copy link
Copy Markdown
Collaborator

Description

Support to get the mode(dark or light) of the current color theme.

Fixes #627

Changes

  • Added getColorThemeMode method to ColorThemeService class.
  • Added colorLightOrDark utility function.

@kiwiwong kiwiwong self-assigned this Jan 25, 2022
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 25, 2022

Codecov Report

Merging #641 (0b9f8e7) into main (6df9d20) will increase coverage by 0.04%.
The diff coverage is 96.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #641      +/-   ##
==========================================
+ Coverage   89.20%   89.24%   +0.04%     
==========================================
  Files         185      185              
  Lines        5532     5562      +30     
  Branches     1302     1314      +12     
==========================================
+ Hits         4935     4964      +29     
- Misses        589      590       +1     
  Partials        8        8              
Impacted Files Coverage Δ
src/common/utils.ts 87.83% <94.44%> (+2.12%) ⬆️
src/services/theme/colorThemeService.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6df9d20...0b9f8e7. Read the comment docs.

Comment thread src/common/utils.ts
* Determine if a color is light or dark.
* @param color HEX or RGB
*/
export function colorLightOrDark(color: string) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个算法有点意思

Copy link
Copy Markdown
Collaborator

@wewoor wewoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@wewoor wewoor merged commit 57f8fab into main Jan 27, 2022
@wewoor wewoor deleted the feat/themeMode branch January 27, 2022 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to get current theme?

2 participants