Dynamic/custom colors on table fields using custom code

Would love some ideas for how to show colors in a table field. Use case is if/when a number is below a threshold, such as zero, I show the number in red. Is there perhaps a way to use custom code to do this?

Hi Tom,

This is possible by using custom code directly inside your database.

For example in Airtable:

I have a “Value” field which is a number field.
Next to it I have a formula field creating the html according to each value.
In this example the formula is:

"<span style='color: " & 
IF(
    AND(Value >= 0, Value <= 5), "red", 
    IF(
        AND(Value >= 6, Value <= 15), "orange", 
        IF(
            AND(Value >= 16, Value <= 30), "blue", 
            IF(
                AND(Value >= 31, Value <= 50), "green", 
                "black"
            )
        )
    )
) & 
";'>" & Value & "</span>"

If the value is between 0 and 5 => red color
If the value is between 6 and 15 => orange color
If the value is between 16 and 30 => blue color
If the value is between 31 and 5 => green color

Here is the result:

I just use a rich text field in Softr to display the html created in Airtable (it also works with the embed field)

Capture d’écran 2024-12-11 154327

I appreciate the response, but I realize now I should have mentioned that we’re using Xano not airtable. I may be able to use functions in Xano, but thought maybe a custom CSS snippet in Softr would do the trick.