Config oXygen to display elements with a particular attribute and value in color

hymanshu
Posts: 10
Joined: Tue Oct 23, 2018 7:37 pm

Config oXygen to display elements with a particular attribute and value in color

Post by hymanshu » Thu Nov 22, 2018 9:29 am

Is there a way to config oXygen to display elements with a particular attribute and value in color?

Example:
I'd like to config the editor to display all elements with the cust_attr attribute and a specific value in a color.
Display cust_attr=Yes in Green and cust_attr=No in Red.

<section cust_attr=Yes>
<ph cust_attr=No>
<li cust_attr=Yes>

Radu
Posts: 7032
Joined: Fri Jul 09, 2004 5:18 pm

Re: Config oXygen to display elements with a particular attribute and value in color

Post by Radu » Thu Nov 22, 2018 9:39 am

Hi,

The Oxygen "Author" visual editing mode is CSS based. So you can use CSS to set various backgrounds and foregrounds for various XML elements:

https://www.oxygenxml.com/doc/versions/ ... uthor.html

Also if the XML element tags appear in the Author visual editing mode you can set various colors to them by matching them with a CSS selector:

https://www.oxygenxml.com/doc/versions/ ... -tags.html

More about how to customize the DITA CSS:

http://blog.oxygenxml.com/2016/10/custo ... iting.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

hymanshu
Posts: 10
Joined: Tue Oct 23, 2018 7:37 pm

Re: Config oXygen to display elements with a particular attribute and value in color

Post by hymanshu » Tue Nov 27, 2018 8:30 am

Do you have an example of the CSS?

Radu
Posts: 7032
Joined: Fri Jul 09, 2004 5:18 pm

Re: Config oXygen to display elements with a particular attribute and value in color

Post by Radu » Tue Nov 27, 2018 10:59 am

Hi,

Probably something like:

Code: Select all

section[cust_attr="Yes"]{
-oxy-tags-color:white;
-oxy-tags-background-color:green;
}
will show the full tag markers for that specific element with those custom colors.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

hymanshu
Posts: 10
Joined: Tue Oct 23, 2018 7:37 pm

Re: Config oXygen to display elements with a particular attribute and value in color

Post by hymanshu » Thu Nov 29, 2018 8:36 am

Big thanks, Radu. I can see the tags in colors now.
One last question. Do I need to define all tags that use cust_attr in the CSS file, or is there a way to make any tag that uses cust_attr in color?

Radu
Posts: 7032
Joined: Fri Jul 09, 2004 5:18 pm

Re: Config oXygen to display elements with a particular attribute and value in color

Post by Radu » Thu Nov 29, 2018 8:42 am

Hi,

It's plain CSS so you can use the "*" universal elements selector:

Code: Select all

*[cust_attr="Yes"]{
-oxy-tags-color:white;
-oxy-tags-background-color:green;
}
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

hymanshu
Posts: 10
Joined: Tue Oct 23, 2018 7:37 pm

Re: Config oXygen to display elements with a particular attribute and value in color

Post by hymanshu » Thu Nov 29, 2018 8:44 am

Please ignore my previous question. I used * in place of the tag and now any tag with cust_attr displays in color.

Post Reply