Fix default generation for nullable colors

This commit is contained in:
Kovid Goyal 2023-03-28 08:08:50 +05:30
parent 0f59a2d543
commit 40ca46d8d8
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -577,7 +577,7 @@ def gen_go_code(defn: Definition) -> str:
elif isinstance(d, Color):
dval = f'style.RGBA{{Red:{d.red}, Green: {d.green}, Blue: {d.blue}}}'
if 'NullableColor' in go_types[name]:
dval = f'style.NullableColor{{Color:{dval}}}'
dval = f'style.NullableColor{{IsSet: true, Color:{dval}}}'
else:
dval = repr(d)
a(f'{name}: {dval},')