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

Post here questions and problems related to editing and publishing DITA content.
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 »

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: 9041
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 »

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 »

Do you have an example of the CSS?
Radu
Posts: 9041
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 »

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 »

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: 9041
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 »

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 »

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