Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

feat(legacy-plugin-chart-calendar): increase the contrast of calendar heatmap color and label #1452

Merged

Conversation

stephenLYZ
Copy link
Contributor

@stephenLYZ stephenLYZ commented Nov 2, 2021

🏆 Enhancements
The algorithm is to decide label color in white or black depending on background color (refer to https://stackoverflow.com/questions/3942878/how-to-decide-font-color-in-white-or-black-depending-on-background-color)

image

@stephenLYZ stephenLYZ requested a review from a team as a code owner November 2, 2021 16:38
@vercel
Copy link

vercel bot commented Nov 2, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/superset/superset-ui/2WNYCb3pL7k4j7qwUBSP3WeVxFBx
✅ Preview: https://superset-ui-git-fork-stephenlyz-feat-calendar-heatmap-superset.vercel.app

@@ -1652,6 +1652,20 @@ CalHeatMap.prototype = {
}
}

function formatTextFill(value) {
Copy link
Member

Choose a reason for hiding this comment

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

This is super nifty! I wonder if we should label it as something more descriptive, like "getContrastingColor" so that we can eventually (after monorepo migration, perhaps) export it from a shared module, like Superset's colorUtils.ts file.

@codecov
Copy link

codecov bot commented Nov 3, 2021

Codecov Report

Merging #1452 (ca7d2aa) into master (4262d4a) will increase coverage by 0.14%.
The diff coverage is 88.46%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1452      +/-   ##
==========================================
+ Coverage   30.48%   30.62%   +0.14%     
==========================================
  Files         498      499       +1     
  Lines       10019    10048      +29     
  Branches     1691     1699       +8     
==========================================
+ Hits         3054     3077      +23     
- Misses       6719     6723       +4     
- Partials      246      248       +2     
Impacted Files Coverage Δ
packages/superset-ui-core/src/color/index.ts 100.00% <ø> (ø)
...cy-plugin-chart-calendar/src/vendor/cal-heatmap.js 0.00% <0.00%> (ø)
packages/superset-ui-core/src/color/utils.ts 100.00% <100.00%> (ø)
...lugin-chart-echarts/src/Timeseries/transformers.ts 42.24% <0.00%> (-1.13%) ⬇️
...uperset-ui-core/src/query/types/AnnotationLayer.ts 100.00% <0.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 4262d4a...ca7d2aa. Read the comment docs.

Copy link
Contributor

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks for adding the complete testing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants