Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jan 27, 2022

Conversation

kiwiwong
Copy link
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

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.

* Determine if a color is light or dark.
* @param color HEX or RGB
*/
export function colorLightOrDark(color: string) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个算法有点意思

Copy link
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