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

Bat theme looks darker in ranger preview than in standard output #2769

Closed
3rfaan opened this issue Jan 6, 2023 · 5 comments
Closed

Bat theme looks darker in ranger preview than in standard output #2769

3rfaan opened this issue Jan 6, 2023 · 5 comments

Comments

@3rfaan
Copy link

3rfaan commented Jan 6, 2023

I've made a custom theme for bat inspired by the Everforest theme by sainnhe. My issue is that in ranger the colors look darker than in the normal output in the terminal. I've attached a picture to show you what I mean.

Above you can see a normal bat output and it shows the right colors. But below in ranger when I open the exact same file in the preview the colors appear to be darker.

Is there any idea on how to get the true colors into the ranger preview?
screenshot-20230103-182139Z-all

@markus-bauer
Copy link
Contributor

Perhaps you should post your theme. Otherwise it will be difficult to debug this.

How do bat themes work? They are just hex colors, right?
Or do you add dim/bright modifiers?

@3rfaan
Copy link
Author

3rfaan commented Jan 11, 2023

Perhaps you should post your theme. Otherwise it will be difficult to debug this.

How do bat themes work? They are just hex colors, right? Or do you add dim/bright modifiers?

Yes they are hex colors and it's saved as .tmTheme file. What is weird that in normal bat output the colors are perfectly fine I just face this issue inside ranger. This is my everforest.tmTheme file:

`

author Arfan Zubi name Everforest colorSpaceName sRGB settings settings background #2F383E caret #D3C6AA foreground #D3C6AA invisibles #08000000 lineHighlight #D3C6AA selection #543A48 gutter #0a000000 gutterForeground #08000000 name Text scope variable.parameter.function settings foreground #D3C6AA name Comments scope comment, punctuation.definition.comment settings foreground #859289 name Punctuation scope punctuation.definition.string, punctuation.definition.variable, punctuation.definition.string, punctuation.definition.parameters, punctuation.definition.string, punctuation.definition.array settings foreground #7FBBB3 name Delimiters scope punctuation, meta.brace, meta.delimiter, meta.bracket settings foreground #859289 name Operators scope keyword.operator settings foreground #E69875 name Keywords scope keyword settings foreground #E67E80 name Variables scope variable settings foreground #D3C6AA name Functions scope entity.name.function, meta.require, support.function.any-method settings foreground #A7C080 name Labels scope entity.name.label settings foreground #E67E80 name Classes scope support.class, entity.name.class, entity.name.type.class settings foreground #E69875 name Classes scope meta.class settings foreground #E69875 name Methods scope keyword.other.special-method settings foreground #A7C080 name Storage scope storage settings foreground #E67E80 name Support scope support.function settings foreground #A7C080 name Strings, Inherited Class scope string, constant.other.symbol, entity.other.inherited-class settings foreground #A7C080 name Integers scope constant.numeric settings foreground #D699B6 name Floats scope none settings foreground #D699B6 name Boolean scope constant.language.boolean settings fontStyle bold foreground #D699B6 name Macro scope entity.name.function.preprocessor settings foreground #DBBC7F name Constants scope constant settings foreground #83C092 name Tags scope entity.name.tag settings foreground #E69875 name Attributes scope entity.other.attribute-name settings foreground #DBBC7F name Attribute IDs scope entity.other.attribute-name.id, punctuation.definition.entity settings foreground #D699B6 name Selector scope meta.selector settings foreground #05000000 name Values scope none settings foreground #D3C6AA name Headings scope markup.heading punctuation.definition.heading, entity.name.section settings fontStyle bold foreground #E69875 name Units scope keyword.other.unit settings foreground #E69875 name Bold scope markup.bold, punctuation.definition.bold settings fontStyle bold foreground #7FBBB3 name Italic scope markup.italic, punctuation.definition.italic settings fontStyle italic foreground #7FBBB3 name Code scope markup.raw.inline settings foreground #D3C6AA name Link Text scope string.other.link, punctuation.definition.string.end.markdown, punctuation.definition.string.begin.markdown settings foreground #01000000 name Link Url scope meta.link settings foreground #09000000 name Quotes scope markup.quote settings foreground #09000000 name Separator scope meta.separator settings background #0b000000 foreground #07000000 name Inserted scope markup.inserted settings foreground #02000000 name Deleted scope markup.deleted settings foreground #01000000 name Changed scope markup.changed settings foreground #05000000 name Colors scope constant.other.color settings foreground #E69875 name Regular Expressions scope string.regexp settings foreground #A7C080 name Escape Characters scope constant.character.escape settings foreground #A7C080 name Embedded scope punctuation.section.embedded, variable.interpolation settings foreground #05000000 name Illegal scope invalid.illegal settings background #01000000 foreground #0f000000 name Broken scope invalid.broken settings background #09000000 foreground #00000000 name Deprecated scope invalid.deprecated settings background #0e000000 foreground #0f00000 name Unimplemented scope invalid.unimplemented settings background #08000000 foreground #0f000000 uuid uuid `

@markus-bauer
Copy link
Contributor

Isn't this supposed to be a xml file?

@markus-bauer
Copy link
Contributor

markus-bauer commented Jan 12, 2023

I think this also happens with some of the builtin themes (I tried gruvbox-light).
I suspect it is related to the COLORTERM variable in scope.sh:

env COLORTERM=8bit bat --color=always --style="plain" \

Set this variable in you terminal before running bat, and then compare bat and scope/ranger again.

If you want, you can also test it by removing the COLORTERM part in scope.sh. Then run that file directly. Just put in some dummy values for the other arguments:

~/.config/ranger/scope.sh FILE_NAME 100 100 "" ""

Now here's the problem. If you try it with ranger, it won't work, because ranger can't render that output.

There's a discussion about it here (search for COLORTERM):
#1394

And here's where I reach the end of my knowledge.

It might be that ranger's ansi parsing is incomplete.
More likeley it's because ncures only introduced extended color (true color, direct color, whatever it's called) recently and it would require python 3.10 (I think).

@toonn
Copy link
Member

toonn commented Mar 7, 2023

That's exactly right, thanks for doing the digging : )

Closing this for now, extended color support will probably be implemented at some point.

@toonn toonn closed this as completed Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants