-
Notifications
You must be signed in to change notification settings - Fork 81
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
Custom highlights #138
Comments
You can avoid having to convert to hex, at least, by turning on CSS expression parsing: :call css_color#init('css','none','') … and just copy-pasting to a comment: point = egg_graph_point_new ();
point->x = (gint32) up_history_item_get_time (item) - offset;
point->y = up_history_item_get_value (item);
if (up_history_item_get_state (item) == UP_DEVICE_STATE_CHARGING)
point->color = gpm_color_from_rgb (255, 0, 0); // rgb(255, 0, 0)
else if (up_history_item_get_state (item) == UP_DEVICE_STATE_DISCHARGING)
point->color = gpm_color_from_rgb (0, 0, 255); // rgb(0, 0, 255)
else if (up_history_item_get_state (item) == UP_DEVICE_STATE_PENDING_CHARGE)
point->color = gpm_color_from_rgb (200, 0, 0); // rgb(200, 0, 0)
else if (up_history_item_get_state (item) == UP_DEVICE_STATE_PENDING_DISCHARGE)
point->color = gpm_color_from_rgb (0, 0, 200); // rgb(0, 0, 200)
else {
if (g_strcmp0 (history_type, GPM_HISTORY_RATE_VALUE) == 0)
point->color = gpm_color_from_rgb (255, 255, 255); // rgb(255, 255, 255)
else
point->color = gpm_color_from_rgb (0, 255, 0); // rgb(0, 255, 0) Not a great solution, but a workaround that you can use immediately at least. Beyond that, I’ll have to think about how to do this. |
hmm, rgb is a nice trick. Using:
I'm playing with
But still has to ignore the function name (with If I found something more general than my use case (a general extension valid for more use cases I will let you know) Would be interesting to find different interesting use cases |
Right now this allows me to see the color without include text only useful to understand the colors involved, which is really great. Other interesting things:
In general what this issue looks for is for a custom parse regexp that discover a color definition (R,G,B in my use case) and paint it as a info layer somewhere for each match. |
Using functions to create rgb colors is pretty command in UI, if you want to check what color you're creating would be interesting to add custom highlights for a file:
Real example:
Defining colors for a graph point:
https://gitlab.gnome.org/GNOME/gnome-power-manager/-/blob/master/src/gpm-statistics.c#L794
Adding comments after each line (and converting to hex is a workaround:
but would be nice if we are able to highlight just the function:
That would be something like automatize:
The text was updated successfully, but these errors were encountered: