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

Transparent background #23

mys721tx opened this issue Aug 1, 2019 · 1 comment


Copy link

commented Aug 1, 2019

Currently, all transparency are hardcoded to 0xff:


Lines 27 to 32 in c277f1a

((rgb >> 16) & 0xff) as u8,
((rgb >> 8) & 0xff) as u8,
(rgb & 0xff) as u8,

There should be a switch to toggle the background transparency so that the output image can be readily used without concerns of background color.

I can think of are two way to implement this:

  1. Change the RGBA parsing so that the alpha will also be parsed. This may involves extra handling of RGB string. This may allow transparent theme in the future.
  2. Create a new boolean argument so that it will override the alpha setting in Config.background. This likely will involve some processing outside of the struct declaration.

I would like to invite comments from everyone for how to proceed.

@Aloxaf Aloxaf added the enhancement label Aug 4, 2019


This comment has been minimized.

Copy link

commented Aug 8, 2019

I'd like to choose the first way. But I'm not sure whether it will affect the other function of silicon. Silicon should have some tests.

BTW, the transparent theme is already supported (if there are)


Lines 36 to 41 in 4ea9203

impl ToRgba for syntect::highlighting::Color {
type Target = Rgba<u8>;
fn to_rgba(&self) -> Self::Target {
Rgba([self.r, self.g, self.b, self.a])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.