_Color() formula no longer supporting "kr-" syntax?

Hi guys

Prior to today, there was quite a bit of flexibility available to format text in a small set of standard colors. The format was kr-[color]-[shade]-[fg/bg].

For example, if you wanted to programmatically color a string red, you could use something like:
kr-red-medium-fg, To add a yellow background to that, you’d use kr-yellow-light-bg. The full formula would be:

_Color(“kr-red-medium-fg kr-yellow-light-bg”, “My Text”)

It seems that this is broken, as of today :frowning: The color part of the formula still supports hexcodes (eg _Color(“#ff0000”, “I’m red”), and now supports a new syntax with just the base color (eg _Color(“red”, “I’m Red”) which previously wasn’t possible).

Additional examples which are also broken include kr-highlight (an easy yellow highlight), along with the interactive hover states kr-red-gradient-interactive.

Is there a new syntax that is as flexible as the “kr-” syntax was?

5 Likes

@Jono_Bouwmeester Did you figure this out? I have been wondering the same thing.

Alas, sorry to be the bearer of bad news @Jason_Knott. I asked Coda Support about this a while back when I first saw something had changed, and unfortunately the KR- syntax is no longer supported. It was depreciated when the new Coda 3.0 update launched (the update that included side-by-side content and the new Canvas column type).

As far as I’m aware, at the moment the _Color() formula just supports hex codes (eg “#FF0000”) and the 8 named colors (ie Red, Orange, Yellow, Green, Blue, Purple, Pink, Gray).

_Color("#FF0000", "I'm Red")
_Color("Red", "I'm also Red")

There no longer appears to be any way to control the background color nor the hover state programmatically, which were handy features of the KR- syntax. The workarounds I’m using at the moment are:

  • Setting up a “templates” table with {1} placeholders where the template text has background color applied to it, then using the Format() formula to dynamically add my text to that formatted template. Something like Format(@Blue Background.[template], "My text"). Don’t know if that makes sense - shout if you need some clarity.
  • SVG is cool too. @Max_Xyzor had an amazing example he posted to the community a while back, which I use often. You’re going to have to search for it, can’t seem to find it at the moment, sorry!
  • The Latex pack offers some features for rendering text in weird and wonderful styles. I don’t have any docs handy for you at the moment, sorry. I think I remember reading the Latex pack outputs SVG, so it’s kinda the same thing as the second point above, however the syntax may be a little less difficult to implement from scratch.

Anyways, hope that was helpful. No one else seems to be missing KR- except you and I, so it’s good to know I have at least one other person in the world to shed a tear with. Haha