Skip to content

Commit

Permalink
fix: skeleton with color having opacity (#3873)
Browse files Browse the repository at this point in the history
  • Loading branch information
jyash97 authored Apr 9, 2020
1 parent 0b04cc6 commit 5cbe097
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/app/src/app/pages/Sandbox/Editor/Skeleton/elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const pulse = keyframes`
`;

export const SkeletonTextBlock = styled.div(props => {
const color = props.theme.colors?.sideBar.border || '#242424';
let color = props.theme.colors?.sideBar.border || '#242424';
const themeType = props.theme.vscodeTheme.type;

/**
Expand All @@ -23,7 +23,16 @@ export const SkeletonTextBlock = styled.div(props => {
const backgroundLuminosity = themeType === 'light' ? 86 : 14;
const highlightLuminosity = themeType === 'light' ? 88 : 16;

// Color('#ff000033') throws error.
const colorWithOpacity = color.length === 9;

if (colorWithOpacity) {
// remove the opacity
color = color.slice(0, -2);
}

const hsl = Color(color).hsl();

const background = Color({ ...hsl, l: backgroundLuminosity }).hslString();
const highlight = Color({ ...hsl, l: highlightLuminosity }).hslString();

Expand Down

0 comments on commit 5cbe097

Please sign in to comment.