Changing the color of label in oxy_checkbox

Post here questions and problems related to editing and publishing DITA content.
Raga Mounika
Posts: 49
Joined: Mon Mar 28, 2016 3:54 pm

Changing the color of label in oxy_checkbox

Post by Raga Mounika »

Hi Team,

I need to change the color of oxy_checkbox label(by default it is black)I want the label in gray color.Is it possible to change it?
I am using this oxy_checkbox for <image> ,scalefit attribute. When an image is inserted in booktitle in a bookmap then only this scalefit should appear in gray color and in rest all other positions it should be in black color.
Please help me in solving this issue.

Best Regards,
Mounika
alex_jitianu
Posts: 1009
Joined: Wed Nov 16, 2005 11:11 am

Re: Changing the color of label in oxy_checkbox

Post by alex_jitianu »

Hi Mounika,

The check box form control accepts a 'color' property. You can use this together with a proper selector:

Code: Select all


*[class~="bookmap/booktitle"] *[class~="topic/image"]:before {
content: "Scale: " oxy_textfield(edit, '@scale', width, 10em)
"Scalefit: " oxy_checkbox(edit, '@scalefit', values, 'yes', color, gray) "\A "
}
Best regards,
Alex
Raga Mounika
Posts: 49
Joined: Mon Mar 28, 2016 3:54 pm

Re: Changing the color of label in oxy_checkbox

Post by Raga Mounika »

Hi Alex,

By the code you provided the content before checkbox is gray.I want the checkbox label "scalefit" to be in gray color.Is there any possibility to change the label to gray color.

Please find the below checkbox code
content: "scale " oxy_textfield(edit, '@scale', width, 2.75em)
oxy_checkbox(edit, "@scalefit",
values, "yes",
uncheckedValues,"no",
labels, "scalefit",
fontInherit, true
);

Regards,
Mounika
alex_jitianu
Posts: 1009
Joined: Wed Nov 16, 2005 11:11 am

Re: Changing the color of label in oxy_checkbox

Post by alex_jitianu »

Hi Mounika,

That's strange. The "color" property, when set on a check box form control, will apply on the check box label. I suspect that you accidentally put the property in the CSS rule (instead of inside the oxy_checkbox() function) and that's why it affected the label before the form control. Here is the correct code:

content: "scale " oxy_textfield(edit, '@scale', width, 2.75em)
oxy_checkbox(edit, "@scalefit",
values, "yes",
uncheckedValues,"no",
labels, "scalefit",
color, gray,
fontInherit, true
);

Best regards,
Alex
Raga Mounika
Posts: 49
Joined: Mon Mar 28, 2016 3:54 pm

Re: Changing the color of label in oxy_checkbox

Post by Raga Mounika »

Hi Alex,

Thanks for the solution.The solution you provided actually works for image element(without any parent and child class). :)
Can you please tell me how to prevent a child element from inheriting parent styles.
Because I suppose the issue in my case because of parent element.
Please go through the below code which I used for image

Code: Select all

*[class~="topic/image"]:after {
display:block;
content: "scale " oxy_textfield(edit, '@scale', width, 2.75em)
oxy_checkbox(edit, "@scalefit",
values, "yes",
uncheckedValues,"no",
labels, "scalefit",
fontInherit, true
);
font-family:sansserif, verdana, helvetica;
font-size:0.75em;
}
It is working proper when image is in topic.But, when an image is inserted in booktitle or tasktitle I am getting an issue regarding scale and scalefit attributes which I discussed in the previous reply to this post.
So please suggest me how to prevent the styling for image when inserted in booktitle and tasktitle.
This is the code I used for booktitle and tasktitle

Code: Select all

*[class~="bookmap/booktitle"] *[class~="topic/image"]:after {
display:block;
content: "scale" oxy_textfield(edit, '@scale', width, 2.75em)
oxy_checkbox(edit, '@scalefit', values, 'yes',uncheckedValues,'no', labels, "scalefit", color, gray);
font-family:sansserif, verdana, helvetica;
font-size:0.75em;
}

Code: Select all

*[class~="topic/title"] *[class~="topic/image"]:after {
display:block;
content: "scale" oxy_textfield(edit, "@scale", width, 2.75em)
oxy_checkbox(edit, "@scalefit", values, "yes", labels, "scalefit", color, gray);
font-family:sansserif, verdana, helvetica;
font-size:0.75em;
}
The font-size which I declared here is also not working.I am the getting the font -size of respective titles and color for scale is title's color and for scalefit (label) is black.
I need the attributes for image element when inserted in booktitle, tasktitle look same as image when inserted in topic.

Please help me in solving this as we are having release in next week.

Thank you.

Regards,
Mounika
alex_jitianu
Posts: 1009
Joined: Wed Nov 16, 2005 11:11 am

Re: Changing the color of label in oxy_checkbox

Post by alex_jitianu »

Hi Mounika,

Here is a variant that will make the form controls look the same in both contexts. What you should be aware of:
- if you take a look at 'booktitle' class attribute you will see that it is a specialization of topic 'title'. This means that if you want to style them equally, only one rule suffices.
- 'em' unit is relative to the font-size of the element. This means that when used in different rules it might give you different results (because the font property is inherited automatically).

Code: Select all

*[class~="topic/image"]:after {
display:block;
content: "scale " oxy_textfield(edit, '@scale', width, 2.75em)
oxy_checkbox(edit, "@scalefit",
values, "yes",
uncheckedValues,"no",
labels, "scalefit",
color, gray,
fontInherit, true
);
font-family:sansserif, verdana, helvetica;
font-weight:normal;
font-size:14px;
}

*[class~="topic/title"] *[class~="topic/image"]:after {
display:block;
content: "scale" oxy_textfield(edit, "@scale", width, 2.75em)
oxy_checkbox(edit, "@scalefit", values, "yes", labels, "scalefit", color, gray, fontInherit, true);
}
Best regards,
Alex
Raga Mounika
Posts: 49
Joined: Mon Mar 28, 2016 3:54 pm

Re: Changing the color of label in oxy_checkbox

Post by Raga Mounika »

Hi Alex,

Thank you so much.
The code is working :)

Regards,
Mounika
Post Reply