Skip to content

The API for adding Styles #10

Description

@anandology

There are multiple options for the API to add styles.

Circle(fill="green")

Circle(style=Style(fill="green"))

Circle() | Style(fill="green")

The first one looks too low-level. Every shape must handle fill, store, store-width etc. When support for gradients etc. added, then every shape must support them too.

Moving all the styles to a Style object looks like a good idea to me. It is not clear if we should see that as a property or a transform. My preference as of now is to make it a property.

# as property
shape = Group([Circle(), Rectangle()], style=Style(stroke="red"))

# as transform
shape = Circle() + Rectangle()
shape = shape | Stlye(stroke="red")

Style is both a noun and a verb. In the first case, it is used as a noun and the in the second case it used as a verb.

@amitkaps do you have any suggestions?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions