Comments (7)
Yes, that would be possible in theory, but probably too localized and complicated to be ever implemented in Foliate itself.
Some alternatives, when the book already has syntax highlighting, which most of them do, are
- Allow disabling color overrides
- Use other methods such as filters to change the colors
- Bring back support for
__ibooks_internal_theme
, and then the book itself can use-webkit-text-fill-color
to force the text color
from foliate.
This is a feature to ensure that the text is legible. I think this is also the behavior in Apple Books and Readium/Thorium.
I suppose the easiest way out would be to just add an option to disable this.
from foliate.
This is a feature to ensure that the text is legible. I think this is also the behavior in Apple Books and Readium/Thorium.
I suppose the easiest way out would be to just add an option to disable this.
Thank you for your quick response! Just to avoid confusion: Is my assumption correct that the non-default themes don't have a code-block specific stylesheet that would fit their color scheme? (so they are colored as if they are plaintext).
from foliate.
The syntax highlighting is part of the stylesheet of the EPUB file. Most EPUB files are designed to be displayed on a white background only and look broken when you apply a custom theme. So when using non-white background, Foliate overrides all foreground and background colors so that the theme would be applied consistently and the text would remain readable. See 29eed7e.
from foliate.
@johnfactotum Thanks for explaining, makes way more sense now 🙂 ! I did not know that the syntax coloring is baked into the EPUB itself.
I was hoping that code blocks were somehow defined in a more generic way in EPUB (like a <code></code>
-block), so that applying a syntax theme would be relatively easy.
I wonder if it would be feasible to heuristically identify code blocks and then define a custom theme for those section.
Anyways, feel free to close the issue if you like.
from foliate.
Yes, the code should be marked up with the <code>
element. However, to quote the HTML Standard:
There is no formal way to indicate the language of computer code being marked up.
So automatically applying syntax highlighting would be problematic.
from foliate.
I see. So, just to entertain the idea: although there is no formal way, auto-detection of the language inside a block could be an option (perhaps as an option that is disabled by default, or more involved, via a button to change the detected language). For example highlight.js does supports auto-detection of languages.
from foliate.
Related Issues (20)
- Is it possible to remove the border? HOT 3
- Option to watch folders
- Possible to downgrade GTK dependency? HOT 2
- Improved search navigation suggestions HOT 3
- Equation render problem HOT 5
- Icons not rendering properly in some parts of the application HOT 2
- User stylesheet not working HOT 2
- Building from source fails HOT 3
- How to change highlight color? (plase refer to the screenshot) HOT 2
- Foliate should not separate quotation marks from text across line breaks when rendering EPUB files HOT 7
- High Contrast Dark Mode
- Line Height and Justification do not apply to some books HOT 1
- Is there any way to configure TTS in Foliate 3.1.1? HOT 1
- Text doesn't show. HOT 1
- Improve SVG viewer
- Any chance for an AppImage version ? HOT 1
- Option to open PDFs in external app
- Resize one foliate instance, the other foliate instance would also follow
- Allow trusted books to load contents from the internet HOT 3
- Segfault(often but not always) when copying text HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from foliate.