Elytra Blog

The simple RSS Reader. This blog publishes release notes, engineering and design details.

New Code Theme

As part of the v2.0 release cycle, I’ve been working on a macOS/UIKit inspired code theme. In this post, I’m sharing what I have come up with so far inviting feedback and suggestions for changes. 

The colours are platform specific, so they will be slightly different across iOS/iPadOS, macOS and the Web. Work on the web part is pending but it’ll look mostly similar to the macOS screenshots.

macOS

On macOS, the colours will respect platform specific accessibility features like enhanced contrast, and light & dark modes.

The new Elytra Code theme on macOS

All colours are taken directly from the system provided semantic colours with some alpha tweaks in places where it makes sense.

iOS

The story is similar on iOS just like macOS. System provided semantic colours are used throughout.

The new Elytra Code theme on macOS

Across the board, I quite like how this is rendering. It’s softer on the eyes too, and if you didn’t notice, the code blocks no longer use the Menlo typeface at a static 16pt. It’ll now scale dynamically to your font-preference, system sizing or custom, using the SF Monospaced typeface from Apple.

In a future update, I’ll look into embedding additional Monospaced fonts suited for viewing code (my current favourite being Fira Code).

I’ll share additional screenshots on Twitter as I go along tweaking and optimising the code.

Technical

So let’s get into the technical details of this for those of your interested.

Here is an excerpt of what the original css structure looked like.

.hljs {
	color:#333;
	background:#ffffff
}

.hljs-comment,.hljs-quote {
	color:#998;
	font-style:italic
}

.hljs-keyword,.hljs-selector-tag,.hljs-subst {
	color:#333;
	font-weight:bold
}

This is from the light theme of my CodeParser. This CSS file is imported by the Class, parsed and processed to convert those hex values into their respective UIColor counterparts and then used in Attributed Strings.

So to make this existing system use semantic system colours included making some trivial changes to my code base, starting with the CSS file which now looks like this:

.hljs {
	color:*labelColor;
	background:*systemBackgroundColor
}
.hljs-comment,.hljs-quote {
	color:*systemPinkColor#.75;
	font-style:italic
}
.hljs-keyword,.hljs-selector-tag,.hljs-subst {
	color:*labelColor;
	font-weight:bold
}

I’m now directly using the semantic colour names, prepending it with an asterisk to denote a semantic color name, and followed by a pound with the alpha component.

As you can imagine, parsing the above is pretty trivial, so is detecting if it should use the semantic name using -[UIColor performSelector] or the method from my HEX to UIColor category.

Once all of this is wired up, the information is assigned to ranges in the Attributed String the same way as it did before with no changes to that part of the code.

With this new system in place, I can use any of the semantic colours exposed by the host OS, of pure hex values or a combination of both in the same file which makes this solution very versatile and light weight.

Here’s a reference to Apple’s documentation regarding the various semantic colours and their respective RGB values in Dark and Light modes.

I’ll be publishing the iOS Beta including this change shortly to TestFlight. Do try it and send me your feedback. 

Elytra & Big Sur

It’s been some time since I posted an update here and since I was gathering some screenshots of my progress on the Mac Catalyst app, I thought I would share my progress here as well for everyone to check out.

Hello, Big Sur

As noted in my previous post (WWDC20 and Elytra), I mentioned I’d release two separate builds, one for Catalina and another for Big Sur. But looking at how much better the app is using new technologies released this year, the plans have changed a bit. There won’t be a Catalina build, not anytime soon anyways. However, here’s an early look at the work in progress app running on Big Sur:

Elytra running on Big Sur with an article open from the unreads section

Elytra running on Big Sur with Large Sidebar Icons enabled under the OS Preferences.

Elytra supports OS tinting and will use your preferred tint color from the OS preferences

Elytra on Big Sur also supports inline playback and Youtube support just like the iOS App.

Elytra on Big Sur will also bring Multiwindow support similar to the Web App for opening Articles in separate windows.

The app is probably only 50% done. There a lot of tweaks and adjustments that need to be precisely made so that the app feels native to macOS Big Sur. It is still missing critical features like Importing & Exporting OPML files and managing your Subscriptions.

So I’d definitely tag this as Alpha for now. Once I determine it has all the necessary features from its iOS and Web counterparts, I’ll tag a beta pipeline and figure out a way to introduce it to testers. So if you’re interested in helping me test the macOS App, have Big Sur running on one of your computers, send me DM on Twitter or email me. Also send in any feedback or features you’d like to see in the macOS app.

Happy Reading!