Flutter : Custom Painter draw path with different fill and stroke color - flutter

I am using the CustomPainter to draw a line chart where the line(stroke) needs to be of a different color and the fill color should be a different shade of it.
I could draw the chart but both with same colors.
However, I need the colors to be different.
How can I do this with a CustomPainter?
Also, I want to know how to have a single path painted with different colors instead of a single color if possible.
Thanks for your help!

I personally draw the stroke with "drawLine" calls and the fill with "drawPath".
You can define 2 different paints and use paint1 with "drawLine" and paint2 with "drawPath".

Related

How to generate Material Design Color set of selected color programmatically?

Question 1.
Let's assume the selected color is #a85c40.
Now, how can we generate the Material color with some nearby shade from that picked color. The nearby material shade will be like shade 800.
Question 2.
How to generate a colors sets of all colors with shade500 ?
You can use this tool to generate the colors.
You can use the colorScheme: property of the ThemeData() and pass a ColorScheme() object where you can set all the desired properties.
This video explains it https://www.youtube.com/watch?v=ZUi3hppgG2s

Create Color Variations From Main Color

I have a main color in Flutter, Color(0xFF6E8898), and what I want to do is create variations or shades from that color. For example here is a chart with different variations of one main color:
Right now, I have one color, but I don't know how to create different shades or variations from it. Current Picture:
Thanks for any help.
Note: I don't think it matters, but just in case charts_flutter has a method for this I am using the charts_flutter library to generate my charts
I think this one can help you: https://graphicdesign.stackexchange.com/questions/75417/how-to-make-a-given-color-a-bit-darker-or-lighter
You can write a function to generate color to lighter or darker with a given RGB color.
The material colors have a shade attribute which you can use:
Colors.green.shade300
You can see a list of the shades of all the material colors here.

How to control the smart light (color , color tempreature, brightness)

If the light is set to Red, and I want to modify the brightness.
But the Color Model(rgb or hsb) isn't support the brightness.same with color tempreature.
What should I do? Need to change to White light Model, then adjust the brightness?
So, you want to change the color and brightness both. If that is what you want to do then you have to implement two separate variables for brightness and color. The brightness cannot be controlled using just rgb or hsv, it uses separate variable and it ranges from 0-100.
Go through this:-
https://developers.google.com/actions/smarthome/traits/colorsetting

get the color of a serie that is colorized naturally in xtrachart(devexpress 14.2)

i have some series that i have not specified any color for them and they are colorized naturally by xtrachart. how can i get the color of each of them when they are drawn in plot control?
i found that the color is stored in actual color property but i cant access it normally and i only can get it in debug mode in watch section.
how can i get the color?
You can utilize the SeriesViewBase.Color Property to specifies the series' color.
code snippet:
((SideBySideBarSeriesView)series.View).FillStyle.FillMode = FillMode.Solid;
((SideBySideBarSeriesView)series.View).Color = Color.Red;
From: How to: Custom Draw Series
You can also implement custom drawing in charts when drawing its
series. To do this you should handle the
ChartControl.CustomDrawSeries event, and then you're able to
change some drawing parameters using its event args.
References:
DevExpress forum: series colour
Changing colour of a series point at runtime
c# devexpress piechart series point color change
The answer is here:
get the color of a serie that is colorized naturally
Note that we had need to get the color that was automatically assigned to the series.

CGContext draw with two UIColor with opacity

I am drawing a line using CGContext and color has transparency of 0.7 , Now i want to draw another line with another color with same transparency on that previous line . But i get the second line color as a solid color without any transparency in the part where this both two lines intersect. For first line i am using blend effect clear to draw a transparent line and for the second line i am using blend effect color. Please tell me how to draw these two lines separately so that the second line drawn can have its own separate color .
The default blending mode (kCGBlendModeNormal) should provide the behavior you want in both cases.