Something went wrong. Try again.
test
Something went wrong. Try again.
6.1 kB · 251 lines
Go
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
// Lexicon schema: site.standard.theme.basic
package standardsite
import ( "bytes" "encoding/json" "fmt" "io"
lexutil "github.com/bluesky-social/indigo/lex/util" cbg "github.com/whyrusleeping/cbor-gen")
func init() { lexutil.RegisterType("site.standard.theme.basic", &ThemeBasic{})}
type ThemeBasic struct { LexiconTypeID string `json:"$type" cborgen:"$type,const=site.standard.theme.basic"` // accent: Color used for links and button backgrounds. Accent *ThemeBasic_Accent `json:"accent" cborgen:"accent"` // accentForeground: Color used for button text. AccentForeground *ThemeBasic_AccentForeground `json:"accentForeground" cborgen:"accentForeground"` // background: Color used for content background. Background *ThemeBasic_Background `json:"background" cborgen:"background"` // foreground: Color used for content text. Foreground *ThemeBasic_Foreground `json:"foreground" cborgen:"foreground"`}
// Color used for links and button backgrounds.type ThemeBasic_Accent struct { ThemeColor_Rgb *ThemeColor_Rgb}
func (t *ThemeBasic_Accent) MarshalJSON() ([]byte, error) { if t.ThemeColor_Rgb != nil { t.ThemeColor_Rgb.LexiconTypeID = "site.standard.theme.color#rgb" return json.Marshal(t.ThemeColor_Rgb) } return nil, fmt.Errorf("can not marshal empty union as JSON")}
func (t *ThemeBasic_Accent) UnmarshalJSON(b []byte) error { typ, err := lexutil.TypeExtract(b) if err != nil { return err }
switch typ { case "site.standard.theme.color#rgb": t.ThemeColor_Rgb = new(ThemeColor_Rgb) return json.Unmarshal(b, t.ThemeColor_Rgb) default: return nil }}
func (t *ThemeBasic_Accent) MarshalCBOR(w io.Writer) error {
if t == nil { _, err := w.Write(cbg.CborNull) return err } if t.ThemeColor_Rgb != nil { return t.ThemeColor_Rgb.MarshalCBOR(w) } return fmt.Errorf("can not marshal empty union as CBOR")}
func (t *ThemeBasic_Accent) UnmarshalCBOR(r io.Reader) error { typ, b, err := lexutil.CborTypeExtractReader(r) if err != nil { return err }
switch typ { case "site.standard.theme.color#rgb": t.ThemeColor_Rgb = new(ThemeColor_Rgb) return t.ThemeColor_Rgb.UnmarshalCBOR(bytes.NewReader(b)) default: return nil }}
// Color used for button text.type ThemeBasic_AccentForeground struct { ThemeColor_Rgb *ThemeColor_Rgb}
func (t *ThemeBasic_AccentForeground) MarshalJSON() ([]byte, error) { if t.ThemeColor_Rgb != nil { t.ThemeColor_Rgb.LexiconTypeID = "site.standard.theme.color#rgb" return json.Marshal(t.ThemeColor_Rgb) } return nil, fmt.Errorf("can not marshal empty union as JSON")}
func (t *ThemeBasic_AccentForeground) UnmarshalJSON(b []byte) error { typ, err := lexutil.TypeExtract(b) if err != nil { return err }
switch typ { case "site.standard.theme.color#rgb": t.ThemeColor_Rgb = new(ThemeColor_Rgb) return json.Unmarshal(b, t.ThemeColor_Rgb) default: return nil }}
func (t *ThemeBasic_AccentForeground) MarshalCBOR(w io.Writer) error {
if t == nil { _, err := w.Write(cbg.CborNull) return err } if t.ThemeColor_Rgb != nil { return t.ThemeColor_Rgb.MarshalCBOR(w) } return fmt.Errorf("can not marshal empty union as CBOR")}
func (t *ThemeBasic_AccentForeground) UnmarshalCBOR(r io.Reader) error { typ, b, err := lexutil.CborTypeExtractReader(r) if err != nil { return err }
switch typ { case "site.standard.theme.color#rgb": t.ThemeColor_Rgb = new(ThemeColor_Rgb) return t.ThemeColor_Rgb.UnmarshalCBOR(bytes.NewReader(b)) default: return nil }}
// Color used for content background.type ThemeBasic_Background struct { ThemeColor_Rgb *ThemeColor_Rgb}
func (t *ThemeBasic_Background) MarshalJSON() ([]byte, error) { if t.ThemeColor_Rgb != nil { t.ThemeColor_Rgb.LexiconTypeID = "site.standard.theme.color#rgb" return json.Marshal(t.ThemeColor_Rgb) } return nil, fmt.Errorf("can not marshal empty union as JSON")}
func (t *ThemeBasic_Background) UnmarshalJSON(b []byte) error { typ, err := lexutil.TypeExtract(b) if err != nil { return err }
switch typ { case "site.standard.theme.color#rgb": t.ThemeColor_Rgb = new(ThemeColor_Rgb) return json.Unmarshal(b, t.ThemeColor_Rgb) default: return nil }}
func (t *ThemeBasic_Background) MarshalCBOR(w io.Writer) error {
if t == nil { _, err := w.Write(cbg.CborNull) return err } if t.ThemeColor_Rgb != nil { return t.ThemeColor_Rgb.MarshalCBOR(w) } return fmt.Errorf("can not marshal empty union as CBOR")}
func (t *ThemeBasic_Background) UnmarshalCBOR(r io.Reader) error { typ, b, err := lexutil.CborTypeExtractReader(r) if err != nil { return err }
switch typ { case "site.standard.theme.color#rgb": t.ThemeColor_Rgb = new(ThemeColor_Rgb) return t.ThemeColor_Rgb.UnmarshalCBOR(bytes.NewReader(b)) default: return nil }}
// Color used for content text.type ThemeBasic_Foreground struct { ThemeColor_Rgb *ThemeColor_Rgb}
func (t *ThemeBasic_Foreground) MarshalJSON() ([]byte, error) { if t.ThemeColor_Rgb != nil { t.ThemeColor_Rgb.LexiconTypeID = "site.standard.theme.color#rgb" return json.Marshal(t.ThemeColor_Rgb) } return nil, fmt.Errorf("can not marshal empty union as JSON")}
func (t *ThemeBasic_Foreground) UnmarshalJSON(b []byte) error { typ, err := lexutil.TypeExtract(b) if err != nil { return err }
switch typ { case "site.standard.theme.color#rgb": t.ThemeColor_Rgb = new(ThemeColor_Rgb) return json.Unmarshal(b, t.ThemeColor_Rgb) default: return nil }}
func (t *ThemeBasic_Foreground) MarshalCBOR(w io.Writer) error {
if t == nil { _, err := w.Write(cbg.CborNull) return err } if t.ThemeColor_Rgb != nil { return t.ThemeColor_Rgb.MarshalCBOR(w) } return fmt.Errorf("can not marshal empty union as CBOR")}
func (t *ThemeBasic_Foreground) UnmarshalCBOR(r io.Reader) error { typ, b, err := lexutil.CborTypeExtractReader(r) if err != nil { return err }
switch typ { case "site.standard.theme.color#rgb": t.ThemeColor_Rgb = new(ThemeColor_Rgb) return t.ThemeColor_Rgb.UnmarshalCBOR(bytes.NewReader(b)) default: return nil }}