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

Add statically typed color representation #171

Merged
merged 10 commits into from Sep 4, 2021
Merged

Add statically typed color representation #171

merged 10 commits into from Sep 4, 2021

Conversation

muehlhaus
Copy link
Collaborator

@muehlhaus muehlhaus commented Aug 29, 2021

This PR adds support to statically typed color representation. Warning: Introduces breaking changes.
However, you still can use Colors from Plotly string by Color.ColorString "red"

Fixes #138
Fixes #124

@@ -52,8 +52,8 @@ let range1 =
Chart.Range(
x,y,yUpper,yLower,
StyleParam.Mode.Lines_Markers,
Color="grey",
RangeColor="lightblue")
Color = Color.ColorString "grey",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be called Color.fromString for consistency?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. Thanks for the hint.

@@ -47,8 +47,8 @@ multiple shapes at once.

open Plotly.NET.LayoutObjects

let s1 = Shape.init (StyleParam.ShapeType.Rectangle,2.,4.,3.,4.,Opacity=0.3,Fillcolor="#d3d3d3")
let s2 = Shape.init (StyleParam.ShapeType.Rectangle,5.,7.,3.,4.,Opacity=0.3,Fillcolor="#d3d3d3")
let s1 = Shape.init (StyleParam.ShapeType.Rectangle,2.,4.,3.,4.,Opacity=0.3,Fillcolor= Color.fromWebColor "#d3d3d3")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would leave out the distinction between "webcolor" and hex and merge them, adding a check if the string starts with a #

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. It is actually the same. I removed fromHex...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for not being clear, but I would rather name both fromHex, this would be the naming web devs would expect when creating colors from hex strings. The name fromWebColor implies that things such as "grey" or "aquamarine" should work as well. So fromWebColor should either accept both hex and standard web color strings, or be renamed to fromHex

@kMutagene kMutagene merged commit 19763db into dev Sep 4, 2021
@kMutagene kMutagene deleted the colors branch October 21, 2021 06:36
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

Successfully merging this pull request may close these issues.

Marker.init Colors not having effect failed to reproduce bubble-scatter-plots example from plotly python
3 participants