vscode-theme-onedark icon indicating copy to clipboard operation
vscode-theme-onedark copied to clipboard

Declare `InlayHint` colours

Open cyqsimon opened this issue 2 years ago • 2 comments

VSCode now enables themes to define colours for inline hints (parameter & type). Unfortunately the default values don't fit One Dark particularly well:

image

They are hints and should be much subtler than that.

So I took a look at One Dark Pro and based my values off theirs (see here). I lowered the contrast a bit to my liking.

"editorInlayHint.background": "#2c323d",
"editorInlayHint.foreground": "#9ba1ad",

Declaring them makes it look much nicer:

image

Sample code

Taken from sharkdp/bat:

You will need to install the Rust toolchain and rust-analyzer to see the hints though, so this may not be the best example. Any supported language with type inference should do.

    let mut report = bugreport!()
        .info(SoftwareVersion::default())
        .info(OperatingSystem::default())
        .info(CommandLine::default())
        .info(EnvironmentVariables::list(&[
            "SHELL",
            "PAGER",
            "LESS",
            "LANG",
            "LC_ALL",
            "BAT_PAGER",
            "BAT_CACHE_PATH",
            "BAT_CONFIG_PATH",
            "BAT_OPTS",
            "BAT_STYLE",
            "BAT_TABS",
            "BAT_THEME",
            "XDG_CONFIG_HOME",
            "XDG_CACHE_HOME",
            "COLORTERM",
            "NO_COLOR",
            "MANPAGER",
        ]))
        .info(FileContent::new("Config file", config_file()))
        .info(FileContent::new(
            "Custom assets metadata",
            custom_assets_metadata,
        ))
        .info(DirectoryEntries::new(
            "Custom assets",
            PROJECT_DIRS.cache_dir(),
        ))
        .info(CompileTimeInformation::default());

Filename and Language selected

Rust (.rs)

Versions used

  • VSCode version: 1.65.1
  • Theme version: v2.2.3

cyqsimon avatar Apr 12 '22 15:04 cyqsimon

For anyone stumbling upon the inlay hints coloring problem for js and ts:

  1. Open settings.json file (Ctrl + Shift + P -> Preferences: Open Settings (JSON))
  2. Add the following lines
"javascript.inlayHints.parameterNames.enabled": "all",
"typescript.inlayHints.parameterNames.enabled": "all",
"workbench.colorCustomizations": {
    "[Atom One Dark]": {
        "editorInlayHint.background": "#2c323d",
        "editorInlayHint.foreground": "#9ba1ad"
    }
}

wentwrong avatar Jul 04 '22 09:07 wentwrong

@akamud

This is definitely a big issue and could be fixed with a max of 30 mins of work. I'd be happy to do it, but only if it would eventually get merged. Seeing the two pull requests open for the last two years is worrying though. Is this still maintained?

For others looking for an alternative, just get the One Dark Pro theme. Looks pretty similar and they declare inlayHints correctly.

joeyame avatar Jul 24 '22 23:07 joeyame

This is now fixed in 2.3.0.

akamud avatar Oct 08 '22 14:10 akamud