Code Monkey home page Code Monkey logo

Comments (6)

teto avatar teto commented on July 20, 2024 1

A PR that can be of interest regarding this issue neovim/neovim#7082

from oni.

bryphe avatar bryphe commented on July 20, 2024

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:

  1. VSCode - uses TextMate themes
  2. 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.

jordwalke avatar jordwalke commented on July 20, 2024

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.

bryphe avatar bryphe commented on July 20, 2024

@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.

bryphe avatar bryphe commented on July 20, 2024

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:

colors-customization

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:

  • #412 - CSS Theming
  • #1051 - Colorization based on TextMate scopes

from oni.

bryphe avatar bryphe commented on July 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.