Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How do I change the text color of end node? #26

Open
hazelcj opened this issue Aug 16, 2022 · 1 comment
Open

Question: How do I change the text color of end node? #26

hazelcj opened this issue Aug 16, 2022 · 1 comment

Comments

@hazelcj
Copy link

hazelcj commented Aug 16, 2022

This tool is awesome.

And I have a question to reach out: how do I change the foreground text color of end node which class is 'hummingbird-end-node' like:
item = item + '<label ' + data_str + '>' + "\n";
item = item + ' ' + treeText;
item = item + '' + "\n";

I have defined data_str in 'li' tag:
li id="id_str" data-str='style="color:green;" '>--Robin Wright</li
But the text color is still:
label style="color: rgb(0, 0, 0);"

Appreciate if you have time to help on this.

@hummingbird-dev
Copy link
Owner

hummingbird-dev commented Aug 17, 2022

Hi,
Thanks for using the hummingbird-treeview.

Normally you can define the colors via the options
prior to initializing the treeview:
$.fn.hummingbird.defaults.hoverColorText2 = "#6879e3";
To change the text color on mouse hover use:
$.fn.hummingbird.defaults.hoverColorText1 = "#e36834";
And to change the background color on mouse hover use:
$.fn.hummingbird.defaults.hoverColorBg1 = "#5acb29";

However, I was able to reproduce what you have observed. It's true,
data-str='style="color:green;"' does not work. In general "color" will
not work here. Thanks for pointing to this issue. I will add this info
to the documentation. The reason is, that the text-color changes
dynamically on hover. Even if "hover" is disabled, the colors are
overwritten by the above options.

Therefor I have now included new data-* attributes to change text
colors and backgrounds for individual nodes via the
data-nonHoverColor, data-nonHoverColor_bg, data-HoverColor, data-HoverColor_bg

Have a look here: https://github.com/hummingbird-dev/hummingbird-treeview#2-simple-pseudo-html-plus-height-scroll-id-data-id-data-css-data-str-data-nonhovercolor-data-nonhovercolor_bg-data-hovercolor-data-hovercolor_bg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants