00:00.000 Introduction
00:58.668 What colour do you like?
03:42.120 Colour spaces: HSL, LCH , and more
06:25.885 color.el and ct.el
08:08.400 Hasliberg theme
11:06.240 Wrap up
01:24.840 Why colour?
03:04.040 What motivated you to learn Elisp and get into the Emacs core?
06:35.320 Q: Is there any intention to create a library for working with more experimental color spaces? Pulling code out of Hasliberg for this purpose, perhaps?
10:51.520 Q: Can we have a dark as well as light theme variations made from your theme?
Emacs comes with various themes to pick from, and there are myriad
different themes out on the Internet. After choosing a theme, you can make
any adjustments to add or remove certain colours exactly as you wish. Emacs
provides you so much control over how you work, write, code, and everything
in between, including the colour choice. You are certainly left equipped
with all the controls for your theme as well.
However, when it comes to colour, there is a bit of difficulty: RGB.
Hexadecimal colour codes are ubiquitous and relatively easy to understand.
Yet, they are difficult to work with, especially when you need to make
different shades and variants. In recent years, CSS started to support not
just sRGB (standard RGB), but other colour spaces such as HSL, Oklab, etc.
With Emacs, we also have a great set of tools from color.el, as well as
this amazing package called ct.el (https://github.com/neeasade/ct.el)
In this talk, we will have a quick look at different colour spaces than
sRGB, namely HSL and LCH. We will check out how ct.el can make a set of
colour shades and variants at ease, and how they can help define themes.
Finally, Ryota will share his own theme called Hasliberg Theme, which is
using the full power of LCH.
Ryota started his Emacs journey more than a decade ago, but was forced to
put it aside for work requirements soon after. A few years ago, he made a
return to Emacs, and now is using Emacs almost exclusively for any sort of
coding tasks. This talk focuses on the modern Emacs setup where he thinks
his Emacs looks and works better than many other editors. He works for Civo
as a Principal Engineer.
Discussion
Questions and answers
Q: Is there any intention to create a library for working with more experimental color spaces? Pulling code out of Hasliberg for this purpose, perhaps?
A: Started the journey just for myself, and didn't think this
would be useful for others.
A: Making it a library is definitely something that I can think
about.
Q: Can we have a dark as well as light theme variations made from your theme?
A: You can customize the code easily into dark, light and change
something based on someone's mood. Keep in mind that it is a
personal theme, so customize as you see fit.
Notes
Interesting idea to be inspired from tailwind and
frontend dev, thanks for talk
Contributing these developments back to ct.el sounds like a really fantastic idea, and I would really love to see it 🙂 I would love to start writing my own themes using this strategy
hasliberg-theme-use-dark-nature-colour-palette (and a dark-red variant) is going to be useful for dynamically switching in as I'm working with remote systems e.g. staging and production systems
i like that type of usage scenario
Fellow orange fan here btw
Ryota must have used those old skool CRT terminals that had orange as their primary colour for orange to be his favourite colour
bernstein color we used to say in German for that type of CRT orange
haven't used it myself, but remembering this retro terminal project, which features some nice looking oldschool term/color schemes https://github.com/Swordfish90/cool-retro-term
rytswd: Thanks for the support everyone! Now the world knows I'm an orange person
Hi, EmacsConf. This is "Colour your Emacs with ease".I'm Ryota Sawada, and today's agenda is:start with a brief introduction.I will be talking about colours quite a bit.What colours do you like?Colour spaces and some packages suchas color.el, ct.el. I'll be touching on a theme calledHasliberg theme, which I created,before wrapping up the talk.A quick introduction about the talk. The slide isavailable as an Org mode file at Codeberg. If you'relooking at it from Org mode, you probably want to haverainbow mode turned on for the best viewing. This is thecase with the presentation today. I'm Ryota Sawada and I'mavailable at rytswd at usual places.
What colour do you like?You might be able to tell I like orange. That'sthe colour that I use often.Emacs gives me all the control I want,so naturally I wanted to make it aestheticallypleasing to my taste, which meant thatI would like to have a dark theme, subtle themewith orange as a main accent colour, but nottoo orange, so not everything very orange.Maybe use another blue-ish colouras another accent. Note that this presentation isbased on the Hasliberg theme, more on thatlater. But when I started my Emacs journey, I didn't startwith creating a new theme from get-go. I started with a themecalled Nova Theme. I really liked it. I made a few tweaksaround Org Mode and headings, so that they were a bit more wasmy liking, which was around orange being sprinkled across.I got to it very nice looking and I really liked it, but whenI started a lot of coding tasks with it, I realized onething: that it was very colourful, and in a way, distracting.it actually wasn't about Nova Theme's fault. It was justmany editors, including Emacs and VS Code and other editorsand modern themes, are filled with colours. Let's have alook. At the top left, you can see Nova theme with a bit of apale greenish background with a few colours. Purple,pink, blue, green. You can see some colours like that withNova theme. Nice looking colours, but still colourful. ModusVivendi Tinted, bottom left, is also very nice lookingmodern theme, but quite colourful. The same can be saidfor ef-themes, owl edition at top right,and Doom Noe as another, bottom right.That led me to think: how can I make my code editingand coding tasks not too distracting, and I can focus onwriting code. That was something I could manage with OrgMode, where I just specifically, basically used orangeshades and not too much more. That's what you're seeing atthe moment. I wanted to do something similar with codingand any general code. That led me to the journey ofcreating my own theme.
But before going to the theme, I need to talk about colourspaces. sRGB, standard RGB, is probably something thatmany people are familiar with. HSL is for hue, saturation,lightness. LCH is for luminance or lightness, chroma, andhue. Those are the colour spaces probably common used invarious spaces, but when it comes to perceptual uniformity,there is an important difference between the colourspaces. Human perception of colour is not verystraightforward. We can see in the reference here...Let's have a look.At the top you can see the shade coming from leftgreen to the right blue,and in the top image, you can see half ofit, perhaps, is very similar green colourand then when it comes to blue,you can see more of the different colour gradientscoming into play. The bottom colour space is based on aperceptually uniform colour space, which gives us a bit moreevenly distributed colour gradient, which will besomething more suitable for deciding on the theme setup andthe colour setup, where you can have various themes that aredefined for human perceptions.Perceptual uniformity is important. For that, it isimportant to mention about CIE, or "InternationalCommission of Illumination" in English. They createdimportant colour spaces called CIE XYZ which was from 1931,CIELAB, and LUV, 1976,respectively. Those are the colour spaces used in variousfields and industries and still relevant. There is aquite a bit that you can read up on.I'm not a colour expert so have some references here,but the TLDR of all of that isconsider using LCH variants over RGB or HSLfor better perceptual uniformity.Specifically CIE Lab-based LCH,which is often called Lab LCHor just LCH. CIELUV-based LCHis called LUV LCH. There is a new rather modern LCH setupcalled OK LCH which is based on OK Lab.So those are the colour spacesthat are worth looking at when it comes to creatingshades.
How do you create shades? Color.el and ct.el aregreat solutions. You can create shades and differentcolours based on RGB and hex. You can see in the red examplehere, FF0000 is a bright red. You can darken it by providingless red values like CC or 88. You can see that the coloursare slightly darker than the FF0000. But what if you areworking with the complex colours such as FBB151, thisparticular orange? That's where color.el, ct.el comeinto play. Color.el is a built-in package in Emacs,so you can use it by just requiring it.color-darken-name andproviding the colour with the hex value with 40%gives you a darker orangewithout doing too much of a colour computationby hand. This hex value is something that Emacsunderstands and rainbow mode does as well. When it comesto ct.el, it's not a built-in solution, but it's moreversatile. It works with various colour spaces so you cansee that ct-edit-hsl-l-dec by 40% would giveus a darker colour by 40%. We can also use LCH variant whichcan use the LCH colour spaces for darkening the colour. Thisresults in slightly different colours for this particularorange, but if you're working with the green or blue or someother colours, it might be worth looking at LCH variantrather than other colour spaces.
With that, let's have a look at Hasliberg theme.This is a theme that I created personallyand the name is based on the Swiss Alpsand with the following ideas in mind. It focuseson setting up shades. Shades, by that...You can see how the topof the heading here is a bright orange colour, andother orange colours, this heading and this headingare based on the toporange colour and then giving some shade and the luminanceadjustment essentially. It follows a pattern from webdesign and tailwind colour shades are a great example thatyou can have a look.It does not use ct.el as it aims to be fullydependency free and does not consider colour contrast foraccessibility. This is because it's personal and Idon't have that particular need.This is based on LuvLCh ratherthan LAB LCH, and that's another reasonwhy I didn't use ct.el,and it is highly experimental. But the code isavailable at Codeberg and GitHub just for your reference.Let's see Hasliberg theme in action. This is the themethat we were looking at for org-mode as well, but for thecode, in this case Elisp. You can see that the colour ismostly white and blue with orange sprinkled across forstring input. You can see some pink showing up as well.Essentially, all the colour setup is done by shades, so most ofit is based on white or neutral, and there will be lighter anddarker variants that can be set for the primary colour of blue.You can see the darker and brighter and lighter coloursbeing used. With that shade setup, I only have to provide afew colours as the base colours. From there, I can define theshades for the theme setup, which leads to creating a moremonotonic colour setup, where this one is a very monotonic,very subtle difference of white colours used for the basecolours. I don't have to make too many changes to the coloursetup. I just have to provide the base colours that aredifferent. The same can be said for this orange, very orangecolour theme, which is based on the base colours oforange-like colours and gives the shade of variousdifferent setup. This means that I can use HaslibergTheme Nature colour palette, and that gives me more of a greenbased colour where all the base colours are set up with agreenish colour setup.
With that, I would like to wrap up with a few ideas whenadjusting themes and working with colours. Maybe considerusing CIELAB, CIELUV, or OKLab-based colour spaces thatwould give you different shades which are easier to workwith for human perceptions. color.el and ct.el can be agreat tool for making shades and working with colour spaces.Hasliberg theme is yet another theme, highly personaland experimental, but could be an inspiration for yourtheme journey. With that, why not sprinkle your Emacs withyour favourite colours? Thank you.
Captioner: sachac
Q&A transcript (unedited)
... Org mode and kind of note taking. And that meant that it wasn'ttoo difficult to get started with. But when I started more onthe coding side, because I'm a software engineer, you know,on the day job. That kind of got me to think that the colors andhow themes look, how Emacs looks, was affecting. And that'show it kind of came to picture. So I could have kind of goneinto a little bit more coding side of things, but I didn'twant to stress too much on the talk. So that's why I kind ofstuck to a very small bits of Org Mode and Elisp. And yeah, Ithink that's how it came about. Yeah, but that's perfectlyfine. That's one of the chief reasons why we have two tracksfor Emacs content. We've had those for the last four years, Ithink. It's because we have a general track, which is moregeared towards people who want a general... well,generally people who are highly interested into org modeand not necessarily into coding, but just to whet theirappetite to what can be done. And on the DevTrack, we have,well, this year we have talked about Rust and about otherfancy things that people can do with Emacs. But, you know,I'm also a software engineer, you know, we do this all thetime. Sometimes it's just fine to just chat about colors andjust the results of what we develop rather than how thesausage is made. So that's completely fine too. I'm not sure
if you mentioned it in your presentation, but why color, outof all the things you could be ricing on your setup, why wereyou so interested about colors? I think it was just thatmainly that I had to do a lot of context switch betweendifferent languages. Elisp is not the one because Elisp issomething that I would do for Emacs editing. But for day job,I had to use mainly Go as I work with Kubernetes quite a bit. SoGo and also web languages like TypeScript, JavaScript, youknow, those languages, where I felt that whenever I wasswitching context to a different language, I felt that it'skind of annoying to see all the different colors inlanguages like TypeScript, where, you know, VS Code waywould be very full of colors. which I felt that, okay, like,why do I have to have that many different colors on let andconstant or the keywords where it could be just a white text?It didn't have to be that colorful. So that was the bit, themost annoying bit when it came to context switching. And Ifelt that that just didn't happen in the Org Mode or writingin general. So I had to find a way to make it work, make morecoding make my coding more kind of friendly to me and that'swhen I thought maybe just the colors are something that'sbothering me and it actually was the case and that's how I gotto more into the color kind of journey and got too much into itI guess. Right, and was it what eventually motivated you to
[00:03:04.040]What motivated you to learn Elisp and get into the Emacs core?
learn Elisp and to get into the Emacs core? Because it'sfunny how you find plenty of people using Emacs in Org Modeand then they find something that they take particularissue with, for you it's the color, and then they just go allin trying to pull the rope as far as they can to try tounderstand as much as possible about what code is managingthis part of the application. Like for you it was color, forme it was the org agenda, I desperately wanted to make OrgAgenda do something that it wasn't able to do. And fiveyears, well, actually, no, 10 years later, I find myselfhosting Emacs Cons. So, you never know just how far you'regoing to be pulling this rope. So, it's really interestingfor me that my call was this. But back to the question, is thiswhat eventually motivated you to get into Elisp and the coreof Emacs? I think that the original journey to move to Emacswas around keybindings that I got annoyed with with othersolutions, not just, you know, not speaking of Emacskeybinding or anything, like anything in general. The mainreason was that I used Dovrak keyboard layout, and thatmeant that all the C-c, C-v, C-p, whatever, It just isall over the place. So I had to find something that could workfor me. And Emacs was a solution that allowed me to doanything. And that's the kind of the journey that itoriginally started. And from there, started tweaking orgmode and writing experience to be tuned to my liking. Colorwas another thing that I thought, OK, maybe I could do iteasily with org mode. And when I started to use more of thecoding side of things on Emacs, I felt that, okay, that wassomething I needed to solve. So Elisp was always kind ofjust a toolkit that, you know, I knew that it was available. Iknew that it would be something that I want to be able to use.So I think in a way color was a good segue to understand how Ican kind of work out more of a complex logic with the editorwithout having to write JavaScript or things that I don'tparticularly like. So yeah, I think the journey around thefunctional languages, functional kind of programming wasalways something that I was keen about. And yeah, the wholejourney kind of made sense for me. And then moving on to thecolor was just one way to get more involved in. So I cantotally see that this journey kind of making to a little bitdifferent angle But yeah, we shall see how that really turnsout. But for now, I think I'm happy with the color setup. Now Ican really focus on the coding. Well, that's all good. AndI'm sure plenty of people listening to you now, you know,find this relatable, how they eventually got intoprogramming. Like for you, you did say that you were asoftware engineer now. But I found plenty of people,especially doing workshops, that just started you know,their software engineering journey just with Emacs andthey just realized they were doing something completelydifferent, like I was studying humanities. But then youtouch Emacs and you realize, yeah, this whole programmingshtick is actually pretty damn cool.And then you find yourself again,five to 10 years later, becoming a softwareengineer. So yeah, that's all good.So we do have a couple ofquestions and I'd like to move into them so that I, I mean,people have questions and for me it's okay for me to chat withyou but obviously it's better if people ask you the questionthemselves. And again, if you want to ask questions to Ryotadirectly, feel free to join us on BBB and whenever we're donewith the questions on the pad, I'm more than happyto let you ask your questions live.
[00:06:35.320]Q: Is there any intention to create a library for working with more experimental color spaces? Pulling code out of Hasliberg for this purpose, perhaps?
All right, so starting with the first question,is there any intention to create a libraryfor working with more experimental color spaces, pullingcode out of Hasliberg for this purpose, perhaps? Although Ido not know. Hasliberg, you might? Yeah, Hasliberg. And toanswer the question, started the journey just for myselfand I didn't think that it would be actually useful for otheruse cases and this conference talk just came about kind ofout of sheer luck really. So the idea I think I can definitelywork it out and I don't think there will be too, the originalcode that I started with was I had to use some color space and Istarted with sRGB and then went to HSL and then went to LCH. SoI think there has been quite a bit that I learned from it. Atthe same time, I may be tempted to actually maybe perhapscontribute back to ct.el rather than creating my own. Ithink that would make more sense perhaps.But for my own kind of taste that I thoughtthat it would be something I can work out in my theme,but I don't have any I think, you know, making alibrary is definitely something that I can think about, butperhaps maybe making it too many packages isn't exactlywhat I want. But for my own use case, I think I just wanted tohave something that just didn't have any externaldependency so that I can use the vanilla Emacs with mycolors. I think that's how it started, but I'm definitely upfor it if there is interest about it. Yeah, well, thank youfor this. It's always good to contribute.I'm tempted to saythat's how they get you. You know, you do something reallycool and you share it with people and they have the, you know,they just ask you, oh, do you have your code online? And yourealize, no, I haven't pushed it. And then they startpressing you on. well, you need to do this, this is amazingand you need to share it. You know, I had plenty of people askme to share my dot files when I was tackling the org agendaissue that I mentioned earlier. And yeah, eventually whenyou get to publishing your stuff, you also feel greatbecause you're putting a little bit of your intelligenceinto the world and it can be the start of the journey forsomeone else. You know, maybe someone will find yourlibrary at some point and realize, yeah, I wanted to dosomething slightly differently. and then they eithercontribute to a library or they make their own but it's acomplete journey that starts with just people taking thetime to publish the content of the brain basically. Yeah,that's the power of open source now. It's just how we reallyappreciate the open source culture being cultivatedthroughout so many years. And yeah, this is something thatI'm definitely keen about. So yeah, open for suggestions.And exactly, that's how I started with the journey. Andyeah, while this is very experimental and very personal,yeah, I'm not, you know, tied down to one particular wayonly. So yeah we'll be open to suggestions like this onewhich I would definitely think about. Yeah that's amazingand just to be clear you know this is not a there's noincentive one. I'm not pushing you to publish your library.You know it was very personal for you and at the end if youbelieve it might be useful for others it's a nice thing toeventually think about publishing it. But just the factthat you showed up at EmacsConf... Sorry, I'mstarting to lose my voice on the morningof the first day. That'snot boding well for the two next days. I mean, just one day.But just thefact that you're showing up at EmacsConf and sharing aboutall of this, the process, how you got to it eventually, it'salso a part of sharing. And I think it's also amazing in itsown way. Absolutely. Okay, I'm going to try to read the nextquestion and then try to cough a little bit. So can we have...Oh, sorry, Bala. Sorry. I was the one who asked the question.I thought I could ask it live here rather than... Thank you.I'll go cough a little bit. So here I am. Thanks, Ryota, forthe nice talk. This is great. I loved it. Your attention todetail was awesome.
[00:10:51.520]Q: Can we have a dark as well as light theme variations made from your theme?
So I was just looking at the code and I waswondering, do you have a dark and a light theme variationwhich can be made from your theme? Or do you have to customizeit every time? That was my question. And thanks for that.Thank you very much. I appreciate your feedback andquestions. So to answer the question, the short answer isthat I do have both dark and light themes with some sorts ofstandard colors that I personally liked. And there were afew things that I showed in the demo. where I showed, I think,three different dark theme colors. So light theme isdefinitely something that I can do.And the idea around Hasliberg themeand just my theming in general was thatwhen I feel like I want to work in dark theme and when I want towork in the standard way, I would just use the standard color.But when I feel like maybe it's just so cold that I wantto have a bit of a warm colors near me, I would use the orangetheme, without changing too much of the kind of generalfeeling and experience. So that can be said for the lighttheme as well. So there is something and the kind ofcustomization isn't that difficult to extend. So I do haveboth dark and light, but primarily I'm just looking at thedark theme as my main driver. But yeah, they are bothavailable. Great. Thank you so much. I will definitely tryyour theme out. I'm definitely on the lookout for a nice,friendly theme. Thank you very much. As I said, this is apersonal theme. I'm not sure if it really fits everyone'sneed, but it is one inspiration that I hope that can lead toanother nice theming that could work for someonespecifically for some use cases. I don't have to solveeveryone's problem. Yeah, and I mean, it was sufficient tobe inspirational to people. I mean, just Bala justmentioned it right now, but I'm sure plenty of people whowatched live, but also people will be watching in thefuture, will have the interest to speak by what you've done.So thank you again so much for this. Yep. All right, well, Idon't see any further questions. So I suggest we movetowards closure. Ryota, do you have any last words? No, Idon't. So yeah, thank you very much for attending. And it wasgreat fun putting this together. And I really didn't thinkthat I would be talking about my personal colors andpersonal favorites, like orange being my favorite color.This wouldn't be something that I would say out in anyconference, to be honest. But it just came out to be. Andhappy that I had a chance. So thank you very much for giving methe opportunity to talk. in this amazing conference andyeah I can't just wait to check out other talks which you knowI know that there isn't you know other talks that arehappening right now I was actually wanted to to join them andcheck check that out so I will probably do that right now.Well, sure. Well, I won't hold you any longer then. Thankyou. For me, it was just amazing to, you know, generally whenyou ask someone what their favorite color, you know, theyjust tell you orange or blue or whatever. They don't go thento chat about 20 minutes about their favorite color and howthey tuned their entire editor to work exactly around theirfavorite colors. So it was inspiring. And I also want to tryit out, frankly, because my theme has been utterly bad forthe last five years and I need some change into my life. Allright. Thank you so much for your time. Thank you very much,everyone. Cheers. Bye-bye.