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

Closed
mys721tx opened this issue Aug 1, 2019 · 2 comments · Fixed by #31
Closed

Transparent background #23

mys721tx opened this issue Aug 1, 2019 · 2 comments · Fixed by #31
Labels
enhancement New feature or request

Comments

@mys721tx
Copy link

mys721tx commented Aug 1, 2019

Currently, all transparency are hardcoded to 0xff:

silicon/src/utils.rs

Lines 27 to 32 in c277f1a

Ok(Rgba([
((rgb >> 16) & 0xff) as u8,
((rgb >> 8) & 0xff) as u8,
(rgb & 0xff) as u8,
0xff,
]))

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 New feature or request label Aug 4, 2019
@Aloxaf
Copy link
Owner

Aloxaf 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)

silicon/src/utils.rs

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])
}
}

@AndydeCleyre
Copy link

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

As in, it's possible to have a theme where the fake window is transparent, revealing the image background behind?

Are there any known themes which do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants