In Sciter you can define CSS constants using @const declarations like this:
<style> @const TEST_STR:"test"; @const TEST_COLOR: rgb(128,0,0); @const TEST_NUMBER: 128; </style>
and use them not only in CSS ( as @TEST_COLOR for example ) but also in script using accessor like this:
var test_str = self.style.constant("TEST_STR");
If you think that self.style.constant
is too narrative then you can define short “stringizer” function for it:
function $const( name ) { return self.style.constant(name) || ""; }
and later use it as:
var t1 = $const(TEST_STR); // "test" string var t2 = $const(TEST_COLOR); // object of type Color, color(128,0,0) var t3 = $const(TEST_NUMBER); // integer, 128