Closed DJRHails closed 1 year ago
Thanks @DJRHails for this feature request.
As you may know, We are working on Pydantic V2
, and Color type
is deprecated in Pydantic V2
.
We moved this and some other extra types to a separate package pydantic-extra-types.
I am moving this issue there.
Appreciated @hramezani!
PR welcome. 👍
The signature should be def as_hex(self, format: Literal['short', 'long'] = 'short')
for backwards compatibility.
Great I'll get a PR in tonight
@Kludex - PR #93
Initial Checks
Description
Currently I use a custom function for converting Pydantic Color to hex, to remove the unexpected return value of
#f00
when I expect#ff0000
instead.I propose (and happy to contribute), an optional parameter e.g.
format="long"
to allow non-compressed hex values.Affected Components
.model_dump()
and.model_dump_json()
model_construct()
, pickling, private attributes, ORM mode