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

[theme] Remove fade color helper #25895

Merged
merged 2 commits into from
Apr 23, 2021
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
4 changes: 2 additions & 2 deletions docs/src/modules/branding/ComparisonTable.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { experimentalStyled as styled, fade } from '@material-ui/core/styles';
import { experimentalStyled as styled, alpha } from '@material-ui/core/styles';
import Table from '@material-ui/core/Table';
import Box from '@material-ui/core/Box';
import TableBody from '@material-ui/core/TableBody';
Expand Down Expand Up @@ -72,7 +72,7 @@ function PlanStatus(props: PlanStatusProps) {
{checkIcon ? (
<CheckIcon
sx={{
bgcolor: (theme) => fade(theme.palette.primary.main, 0.2),
bgcolor: (theme) => alpha(theme.palette.primary.main, 0.2),
color: 'primary.main',
borderRadius: '50%',
p: 0.5,
Expand Down
5 changes: 0 additions & 5 deletions packages/material-ui/src/styles/colorManipulator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ export function recomposeColor(color: ColorObject): string;
export function getContrastRatio(foreground: string, background: string): number;
export function getLuminance(color: string): number;
export function emphasize(color: string, coefficient?: number): string;
/**
* @deprecated
* Use `import { alpha } from '@material-ui/core/styles'` instead.
*/
export function fade(color: string, value: number): string;
export function alpha(color: string, value: number): string;
export function darken(color: string, coefficient: number): string;
export function lighten(color: string, coefficient: number): string;
30 changes: 0 additions & 30 deletions packages/material-ui/src/styles/colorManipulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,36 +237,6 @@ export function alpha(color, value) {
return recomposeColor(color);
}

let warnedOnce = false;

/**
* Set the absolute transparency of a color.
* Any existing alpha values are overwritten.
*
* @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
* @param {number} value - value to set the alpha channel to in the range 0 -1
* @returns {string} A CSS color string. Hex input values are returned as rgb
*
* @deprecated
* Use `import { alpha } from '@material-ui/core/styles'` instead.
*/
export function fade(color, value) {
if (process.env.NODE_ENV !== 'production') {
if (!warnedOnce) {
warnedOnce = true;
console.error(
[
'Material-UI: The `fade` color utility was renamed to `alpha` to better describe its functionality.',
'',
"You should use `import { alpha } from '@material-ui/core/styles'`",
].join('\n'),
);
}
}

return alpha(color, value);
}

/**
* Darkens a color.
* @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
Expand Down