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

fix: Change downloadAsImage to use Superset theme #22011

Merged
merged 2 commits into from
Nov 3, 2022
Merged
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
10 changes: 2 additions & 8 deletions superset-frontend/src/utils/downloadAsImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,9 @@
import { SyntheticEvent } from 'react';
import domToImage from 'dom-to-image-more';
import kebabCase from 'lodash/kebabCase';
import { t } from '@superset-ui/core';
import { t, supersetTheme } from '@superset-ui/core';
import { addWarningToast } from 'src/components/MessageToasts/actions';

/**
* @remark
* same as https://github.com/apache/superset/blob/c53bc4ddf9808a8bb6916bbe3cb31935d33a2420/superset-frontend/src/assets/stylesheets/less/variables.less#L34
*/
const GRAY_BACKGROUND_COLOR = '#F5F5F5';

/**
* generate a consistent file stem from a description and date
*
Expand Down Expand Up @@ -77,7 +71,7 @@ export default function downloadAsImage(
return domToImage
.toJpeg(elementToPrint, {
quality: 0.95,
bgcolor: GRAY_BACKGROUND_COLOR,
bgcolor: supersetTheme.colors.grayscale.light4,
filter,
})
.then(dataUrl => {
Expand Down