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 in editor #12

Open
dontlaugh opened this issue Feb 1, 2020 · 12 comments · Fixed by #15
Open

Transparent background in editor #12

dontlaugh opened this issue Feb 1, 2020 · 12 comments · Fixed by #15
Labels
enhancement New feature or request

Comments

@dontlaugh
Copy link

I have a transparent terminal. I like the way it looks.

In the acc editor, the line numbers have a transparent background, but the editor area does not.

image

Is there a way to configure a transparent background for both?

@hatoo
Copy link
Owner

hatoo commented Feb 2, 2020

Thanks for your issue! 😄

Is there a way to configure a transparent background for both?

No, now. But it can be implemented.

Could you share your environment(OS, terminal software)?

It looks good in macOS + iTerm2.
____________________________2020-02-02_16 10 25

@hatoo hatoo added the enhancement New feature or request label Feb 2, 2020
@dontlaugh
Copy link
Author

dontlaugh commented Feb 2, 2020

My OS is Manjaro Linux with the Xfce desktop.

Here are a two terminals:

Kitty https://sw.kovidgoyal.net/kitty/
image

Xfce Terminal
image

The Kitty terminal is capable of transparent background colors, since the status bar can do it. For example:

image

@dontlaugh
Copy link
Author

So, unfortunately, that status bar is a part of kitty terminal's internal UI. It's not really a terminal program. All other terminal programs I've run in linux have opaque background colors. 🤔

@dontlaugh
Copy link
Author

https://github.com/kovidgoyal/kitty/blob/f9e8a4050ce5b502754934908d0e1691cc7ffc05/kitty/config_data.py#L843

So I think my only path forward is to not set a background color at all in acc. I'll try it out.

@dontlaugh
Copy link
Author

I don't know if it is possible to do this with edits to the .tmTheme file only. :(

@hatoo
Copy link
Owner

hatoo commented Feb 3, 2020

I confirmed that it is not applied transparency if the background color is different from the terminal's default color on Kitty with mac.

I think it can be resolved by adding a config that not to render background-color on editors' screen.

How do you think?

@dontlaugh
Copy link
Author

That might work. I could not figure out how to do that with edits to the xml file (and rebuilding). Maybe there is another command we can use from the syntax library.

@hatoo
Copy link
Owner

hatoo commented Feb 4, 2020

Currently, acc uses Solarized (dark) which is hardcoded in syntect as the theme. and it's not configuable
note: assets/One Dark.tmTheme is not used now.

Accepted/src/syntax.rs

Lines 55 to 63 in 615885d

pub fn load_syntax(&self, extension: &str) -> Option<Syntax> {
let syntax = self.syntax_set.find_syntax_by_extension(extension)?;
// let theme = ThemeSet::load_from_reader(&mut Cursor::new(theme::ONE_DARK.as_bytes())).unwrap();
Some(Syntax {
syntax_set: &self.syntax_set,
syntax,
theme: &self.theme_set.themes["Solarized (dark)"],
})
}

Maybe we should just make a syntax file configurable.
Is it enough for you?

@dontlaugh
Copy link
Author

Runtime configuration would be good!

@hatoo hatoo closed this as completed in #15 Feb 6, 2020
@hatoo hatoo reopened this Feb 6, 2020
@hatoo
Copy link
Owner

hatoo commented Feb 19, 2020

I've succeeded to draw transparent background on kitty on macOS by setting a theme whose background is #000000.

Could you share your screenshot?

Screen Shot 2020-02-19 at 19 07 14

@dontlaugh
Copy link
Author

It works! This is a new computer, but for some reason it's working here. I am traveling, I will try it on my other devices when I get home in a few days.

Environment: Manjaro Linux, Xfce Desktop, Kitty v 1.16

On my other desktop I did have an older version of Kitty, because it is a Ubuntu-based machine and the package manager is not up to date. But the good news is this is my new main laptop! :)

image

@dontlaugh
Copy link
Author

I used the path-based configuration you provided as an option in #15 and copied the OneDark theme into a new file at $HOME/.config/acc/themes/Test.tmTheme, and provided the full path to that theme. And edited the background config to 00000.

Theme in a gist: https://gist.github.com/dontlaugh/62e7cc4b325638adc36d7155f4c9f0df#file-test-tmtheme-L17

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.

2 participants