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

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

Related

How to use Material 3 Surface tones in Flutter?

In my application, I am using Material 3 for theming. I created a theme at Figma with Material Theme Builder and add generated code to my app. But there is something that I can not figure out how to achieve.
For example, material theme builder creates a Surface tones palette that contains six different colors.
I want to use the "Surface at + 1" color for example, it harmonizes the surface color with the primary color.
But generated code doesn't contain any property like surface1 and harmonizeWith property is not working as expected.
Do you have any suggestions?
Those values are derived within the framework. In case you want to calculate values yourself,
final color = ElevationOverlay.applySurfaceTint(color, surfaceTint, elevation);
Here color would be background color, surfaceTint is defined in colorScheme and elevation would be 1-5. You will get the resultant color.
But...
The way it should be used is by using Material widget as parent with providing MaterialType to that Material Widget.
More info could be found here in source code
https://github.com/flutter/flutter/blob/198a51ace9d4a7d79ec01e64d48f8fc6e37fb9d7/packages/flutter/lib/src/material/material.dart#L504

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

How can I make each Packed Bubble a different color?

I have a Packed Bubble dashboard. My Y axis is a list of names and my X axis is a decimal. I want each differing number to be a different color. Can I do this manually?
If you want to color each bubble with a separate color just use the field that each bubble represent in the color shelf. If I understood your data correctly, each bubble basically represents one campaign, so you should use that as the color.
You can manually assign color using Color>Edit Color and assigning the color of your choice.
See image 1.
If you want to color your bubbles based on your measure AVg(NPV/Marketing $) you can do as Alex Blakemore mentioned and use your measure as a stepped color or gradient.
You can use Color>Edit Color here too , in this case manually assigning color is a bit difficult. But if you play with number of steps, the gradient pre-select, etc, you can usually get very close to what ever your wanted it to look like.
Put your numeric field on the color shelf, and either edit the colors to use a stepped set of colors - or change the field to be discrete and choose individual colors to taste.

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.