Grafana singlestat value color - grafana

I need to change value color to black in singlestat pannel, and backgrund color by mertic.
How to change the color of the value separately from the background color?
Example:
Background color green - value color black
Background color red - value color black
In example i do it with F12, and set color manualy, but certainly its not permanent.
Example panel

Those colors below are where you would do it, and make sure to save your graph to persist the changes.
You can think of the single stat as like an "alert",
let's say that
x < 10 is "ok"
10 < x < 25 is "ehhh"
x > 50 is "very bad"
you would have your single-stat display those colors when it is also displaying those values. So
green == "ok"
orange == "ehhh"
red == "very bad"
those values just above the colors you have are where you would set those value/color pairs. If you only want one color, only set one value.
To have the value color follow the status color, click value

Related

Flutter/Dart : How to get single colors from Colorgradient?

I am trying to build a Widget that changes it's background color from green to red over time, but in a fluid way. So similar to a gradient background:
But not as a fixed gradient, but rather a full green background at the beginning, and as the time counts down the background should slowly transition over to yellow, then orange, then red at the end.
I want the color to update every 10 miliseconds so it's not an abrupt change. I am handling the changing with a timer which calculates how much time has passed in relation to the start time and update the color accordingly.
Now - is there any way how I can get A concrete color from a gradient-like object? Like I could just extract the color of a gradient at a specific point (which is the fraction of time_passed/max_time) to use it as the full background?
Or should I actually use Colorcodes and just increase the value of the colorcode every 10ms? That seems not very graceful
Ok I actually found two Solutions:
1. Use Color.lerp(color a, color b, double p) function
What this does is it creates a gradient between a and b, and return the color that exist on point p (value between 0 and 1) on that scale.
This is basically what I wanted, but there is a problem: It doesn't necessarily interpolate those two color with colors that you want to be inbetween, it's more of a brown-ish mix between those two.
2. Install the rainbow_color package
This was exactly what I needed, you can insert multiple custom colors, specify a range of values that you use (in my case 0.0 and 1.0, but it can also be integers), and it returns a gradient between only theese colors:
var rb = Rainbow(
spectrum: [
Color(0xff1fff00),
Color(0xffd0ff00),
Color(0xffffaa00),
Color(0xffffaa00),
Color(0xffff6600)
],
rangeStart: 1.0,
rangeEnd: 0.0
);
return rb[remainingFraction];

Flutter find color between two colors depending on the value

Maybe I could't word my query properly, let me explain what I mean.
I have a variable and depending on its value I want to show colors like:
var percent = 0; // show red color
var percent = 50; // show middle of red and green
var percent = 100; // show green color
Color color = Color.lerp(Colors.red, Colors.green, percent);
Does the trick!

How to set up a colormap from white to green with n shades

I want to set up a Matlab colormap from white (min values) to green (max values) with any number of shades.
I think about a colormap similiar to the summer preset but reversed and with a white edge instead of the yellow one.
c = [zeros(64,1) linspace(0,1,64)' zeros(64,1); % black to green
linspace(0,1,64)' ones(64,1) linspace(0,1,64)']; % green to white
surf(peaks);
colormap(c);

How to overlap color figure on a gray one with colorbar in MATLAB?

I'm trying to color code some parameter values on a gray image in MATLAB. I'm wondering how to show gray image, make parameter values colored on the gray appearance image and on some pixels, and finally draw a colorbar aside the image just showing parameter values range.
Unsuccessful Code since now:
I = Igray; % gray image
Icc = zeros(size(I,1),size(I,2),3); % color coded image
Icc(:,:,1) = I;
Icc(:,:,2) = I;
Icc(:,:,3) = I;
Icc('some address in the image',3) = 'some number between 0 and 255';
imshow(Icc,[])
colorbar % colorbar showing colored parts spectrum
Result image that I need:
Try something like this:
I = Igray; % gray image
RGB = [1.0,0.7,0.2]; % color for patch
x = 30:50;
y = 70:90;
% If you gray image is in the range [0,255], make it range [0,1]
I = double(I)/255;
Icc = repmat(I,[1,1,3]);
block = I(y,x);
Icc(y,x,1) = 1 - ((1-block) * (1-RGB(1)));
Icc(y,x,2) = 1 - ((1-block) * (1-RGB(2)));
Icc(y,x,3) = 1 - ((1-block) * (1-RGB(3)));
imshow(Icc)
I'm sure there is a prettier way to encode this, but this way it shows the intent.
You're basically multiplying the grey values with the RGB color you want to make the patch. By inverting the patch and the color first, and inverting the result, the multiplication makes the patch brighter, not darker. That way you get the effect you want where the dark parts show the color also. If you multiply directly without inverting first, black stays black and doesn't show the color.
You'll have to figure out how to coordinate with the color bar after that. There are commands in MATLAB to set the limits of the color bar, you can find those reading the documentation.
The color bar you show uses the PARULA color map. You could do this to find the right RGB value to color your patch:
T; % value to color your patch in, in range [0,1]
cm = parula(256);
RGB = interp1(cm,T*255,'linear')

Detecting Red Green and Blue by cancelling background

I have continuous image acquisition and have a white paper at the background of the camera (facing the camera)
The image with just the white background is producing a greenish blue tinge due to light bulbs used in the room which is resulting in output as GREEN for the following code
green = im(:,:,2);
red = im(:,:,1);
if sum( green(:)) > sum(red(:))
disp('green');
else
disp('red');
end
Is there any way to CANCEL the white paper background for processing only the color objects that will be placed in front of the camera ??
The Color objects will be RED, GREEN and BLUE squares
The way you are testing for green or red is fundamentally flawed - you need to look for the dominant colour using a suitable threshold, otherwise you will get false positives. E.g.
threshold = 0.7; % determine a suitable threshold empirically
blue = sum(sum(im(:,:,3)));
green = sum(sum(im(:,:,2)));
red = sum(sum(im(:,:,1)));
total = red + green + blue;
if (red / total > threshold)
disp("red");
elseif (green / total > threshold)
disp("green");
elseif (blue / total > threshold)
disp("blue");
else
disp("indeterminate colour");
end