Comments (6)
A PR that can be of interest regarding this issue neovim/neovim#7082
from oni.
Great feedback. I've been wondering how to handle color schemes. One option was just to stick with the default Vim colorschemes.
I was taking a look at some other editors to see how they define colorschemes:
- VSCode - uses TextMate themes
- Atom - uses less files (makes sense based on the way it renders)
I thought at first about just using the vim color themes, but we run into the problem where the UI extension don't respect the themes at all. One option I looked briefly at was reading the set of highlights and applying them to the UI - trying to pick good defaults for the built-in UI elements like the menu, etc.
I like the idea of having the colorscheme configuration be in JS too though, to be consistent with the other configuration. The hardest part with that is to bridge the gap so that users can bring in the themes they are comfortable with.
So from that that, a colors.js
file might look like this:
const config = {
"base": "onedark.vim",
"ui.bgColor": "black",
"ui.autoComplete.border": "gray",
"ui.autoComplete.background": "rgba(200, 200, 200, 0.5)",
..etc...
}
export default config
And once we've parsed this file, we'd convert it the vim-syntax related items to highlight instructions, and preserve the rest to be used in the UI. Is that sort of what you were thinking?
from oni.
highlights and applying them to the UI - trying to pick good defaults for the built-in UI elements like the menu, etc.
I do think that is a good approach. Use the popup menu for the "command p" menu colors for example.
The hardest part with that is to bridge the gap so that users can bring in the themes they are comfortable with.
You could use any existing Vim color scheme, but then just provide a JSON/JS API for creating those (again, could be converted to plain VimScript ahead of time to not block startup time). I think you could take the top 5 Vim colorschemes and port them from VimScript to JS(ON) by hand just so that they serve as an example. Once you give people a JS API to do things, the community tends to come and fill in all the missing pieces for you. I could see them creating all kinds of tools to port over VimScript syntax themes to the JSON format (which is then transformed back into VimScript behind the scenes). I think Atom only ships with 5 stock colorschemes, but look what people have done! I would probably help you port a few of my favorite ones.
And once we've parsed this file, we'd convert it the vim-syntax related items to highlight instructions, and preserve the rest to be used in the UI. Is that sort of what you were thinking?
Yes, except I might suggest that you try to define the entire color scheme in JS instead of supporting the "extension" of the base .vim
colorscheme. It just keeps it simple and makes your job much easier. Because people like JS, you don't need to worry - people will port everything to JS. Everything that can be ported to JS will be ported to JS! :D
And I do believe that converting these high priority (blocking visual load time) configuration should be cached so that the second time you start up the editor, you do not need to recompute them (unless the file changed.) Baking that behavior in early is very wise because it ensures people don't add features that degrade startup time.
from oni.
@teto mentioned in chat that this commit came in: neovim/neovim@db99982, this could be helpful for synchronization too. Hooking the ColorScheme
autocmd and then querying for the highlight groups would allow Oni to tap into some colors besides just the foreground/background color.
An example would be using the corresponding highlight color in auto completion (instead of just that hardcoded green color, we could color function completions with the function highlight group color, etc).
from oni.
Finally starting to make progress on some of these year-old issues! 👍 Thanks for all the thinking around this!
An initial json theming implementation was included with #950 (in PR #975), and is customizable both via json
themes associated with a vim theme... as well as configurable by colors.
directly in configuration:
Here's the wiki additions:
These updates will be included in the next release (0.2.18).
And then there are a few items still being tracked for a complete story:
from oni.
I'll close this out, and track the remaining work in those other items, but of course any feedback is welcome!
from oni.
Related Issues (20)
- Unable to find csproj in golang project HOT 1
- (n)vi(m) in terminal within oni HOT 4
- Rebind regular hjkl motions for moving around globally in Oni's UI HOT 1
- Explorer does not show new files HOT 1
- Oni crashes on LSP call HOT 1
- replace nevim binary with newer
- how to use gopls with oni HOT 1
- Java autocompletion popup displaying wrong suggestion HOT 1
- Fuzzy Finder not working with WSL2 directory HOT 1
- How add support for new language with language server HOT 1
- how to display tabline in Oni? HOT 1
- Oni does not respect editor.quickOpen.execCommand HOT 1
- Adding support for Alt-Shift key bindings HOT 1
- Metals (Scala) language server integration works, but not auto-complete selection
- No file will open on Ubuntu 19.04 HOT 5
- UI freezes for ~10 seconds on :! external commands on Windows HOT 1
- Insiders link in Issue Template is 404'd
- 100%+ CPU spikes when typing colon commands HOT 1
- How to cycle through completions with tab? HOT 1
- Request: add .nix build script 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 oni.