cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Native variables in STYLES (CSS)

Level 8

Native variables in STYLES (CSS)

Hello friends,

 

is it possible to configure the Vuforia Studio to support native variables in css?

Something like this:

:root {
--color: 240, 240, 240;
}

.bg-red{
background-color: rgba(var(--color), 0.5);
}

In present time must write unnecessarily complicated code because:

Screen_204.jpg

thank you for every post.

 

Tomas

 

Tags (2)
1 REPLY

Re: Native variables in STYLES (CSS)

Tomas,

 

I'm not sure CSS Custom Properties (native variables) can be used in Studio, however you can include SASS syntax in the Application STYLES file: the file will be built to a css file using a SASS processor.

 

So, you can do something like this:

 

$color: rgb(240, 240, 240);

.bg-red {
  background-color: $color;
  opacity: 0.5;
}

 

The CSS Custom Properties syntax is flagged by the parser as incorrect: I can't say whether that's just a parser issue or the processor itself doesn't support it.

 

SASS provides features such as:

  • variables
  • nested selectors
  • mixins (reusable groups of CSS declarations, with optional parameters)
  • inheritance (share a set of CSS properties from one selector to another)
  • operators (to do math within a CSS)

 

HTH,

Alessio