code-server icon indicating copy to clipboard operation
code-server copied to clipboard

Load custom CSS

Open ccstr opened this issue 7 years ago • 7 comments

Is it possible to enable some parameter to load custom CSS onto the page? It will be useful for many things. For one, loading a font-family that may not exist on target system.

ccstr avatar Nov 09 '19 03:11 ccstr

We do not support nor plan to support it. This is considered out of scope for VS Code and code-server.

sr229 avatar Nov 10 '19 12:11 sr229

@sr229 I can see why it is out of scope for VSCode.

But for code-server, since code-server owns the whole webpage after auth redirection. There's no way to load additional styles without using some sort of user styles, which needs client-side setup and is not possible in many intended scenario of code-server (say, iPads).

For example, loading a custom font-family is a quite valid use case - it is common for webpages to import the font-family that it uses.

ccstr avatar Nov 10 '19 21:11 ccstr

@xbtsw Use this chrome app to load custom css: Stylish

ncolletti avatar Jan 17 '20 17:01 ncolletti

@xbtsw We do not plan to have extended support for features that are not provided by VS Code natively. If you want better themeing, please use the Extensions instead.

Use the VSCode API as well to build your own themes if you wish. It's already easy to make one.

sr229 avatar Jan 20 '20 10:01 sr229

Something I haven't tried but sounds really interesting is to use a reverse proxy like Nginx to intercept the HTML and then inject your own CSS or JavaScript links. At least, I think that's possible. If not you could just copy the HTML and serve a modified version of it.

The web font scenario is an interesting one though. Maybe that would be a good reason to add an option for loading arbitrary CSS.

code-asher avatar Jan 21 '20 18:01 code-asher

The ability to load fonts via CSS would be nice to have.

@sr229 from a quick look at the extension docs, extensions cannot embed fonts, only theme colours and icons.

@code-asher That would be a good idea, but it is undocumented what you would have to change either via injection or in the HTML, and it looks like to modify the HTML, you would have to build from source. This is likely not desireable from a UX standpoint.

Just-Insane avatar Feb 18 '20 16:02 Just-Insane

See #1374

nhooyr avatar Feb 27 '20 21:02 nhooyr