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

Support rgba format in css.toColor #3814

Closed
Tyriar opened this issue May 18, 2022 · 1 comment · Fixed by #3815, #3819 or #3823
Closed

Support rgba format in css.toColor #3814

Tyriar opened this issue May 18, 2022 · 1 comment · Fixed by #3815, #3819 or #3823
Assignees
Labels
type/enhancement Features or improvements to existing features
Milestone

Comments

@Tyriar
Copy link
Member

Tyriar commented May 18, 2022

VS Code issue: microsoft/vscode#149867

export function toColor(css: string): IColor {
switch (css.length) {
case 7: // #rrggbb
return {
css,
rgba: (parseInt(css.slice(1), 16) << 8 | 0xFF) >>> 0
};
case 9: // #rrggbbaa
return {
css,
rgba: parseInt(css.slice(1), 16) >>> 0
};
}
throw new Error('css.toColor: Unsupported css format');
}

@Tyriar Tyriar added the type/enhancement Features or improvements to existing features label May 18, 2022
@Tyriar Tyriar added this to the 4.19.0 milestone May 18, 2022
@Tyriar Tyriar self-assigned this May 18, 2022
@Tyriar Tyriar reopened this May 19, 2022
Tyriar added a commit to Tyriar/xterm.js that referenced this issue May 19, 2022
This is used for default theme colors and decoration bg/fg.

Fixes xtermjs#3814
@Tyriar
Copy link
Member Author

Tyriar commented May 20, 2022

Didn't do the alpha channel right, rgba(0, 0, 0, 0.5) will fail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Features or improvements to existing features
Projects
None yet
1 participant