\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{duck}[2012/18/07 Duck style for memoir]
 
\RequirePackage{graphicx}
\RequirePackage{xcolor}
\RequirePackage{tikz}
\RequirePackage{xspace}
     
\definecolor{cffffff}{RGB}{255,255,255}
\definecolor{cffcc00}{RGB}{255,204,0}
\definecolor{c008000}{RGB}{0,128,0}
\definecolor{caa8800}{RGB}{170,136,0}
\definecolor{cd4aa00}{RGB}{212,170,0}
\definecolor{ce6e6e6}{RGB}{230,230,230}
     
\newcommand{\drawduck}{%
\begin{tikzpicture}[y=0.80pt, x=0.8pt,yscale=-1, inner sep=0pt, outer sep=0pt]
  \path[draw=cffffff,fill=cd4aa00,line join=miter,line cap=butt,miter
    limit=4.00,line width=0.800pt] (289.7658,342.4506) .. controls
    (293.4584,349.1556) and (295.2173,354.1364) .. (298.7239,363.8487) .. controls
    (300.0599,367.5490) and (304.2774,368.9910) .. (309.0271,369.6055) .. controls
    (313.3139,366.4936) and (315.8847,362.8669) .. (315.6495,358.3984) .. controls
    (307.1798,358.3371) and (304.6295,359.8902) .. (300.8765,361.1153) .. controls
    (297.8112,355.0677) and (295.7751,346.7427) .. (295.9155,340.1421) -- cycle;
  \path[draw=cffffff,fill=cffcc00,line join=miter,line cap=butt,miter
    limit=4.00,line width=0.800pt] (307.8850,259.2932) .. controls
    (307.3146,259.2243) and (309.0106,269.5385) .. (308.4441,269.5168) .. controls
    (307.7483,269.4901) and (303.5583,260.0863) .. (302.8730,260.1319) .. controls
    (302.4066,260.1630) and (305.4392,269.6215) .. (304.9796,269.6865) .. controls
    (304.3229,269.7794) and (299.2884,261.6060) .. (298.6498,261.7692) .. controls
    (298.1794,261.8895) and (302.1034,270.3362) .. (301.6450,270.4952) .. controls
    (295.0522,272.7818) and (290.5972,280.4292) .. (292.9989,292.1104) .. controls
    (299.3668,309.4217) and (282.2672,315.8410) .. (271.2419,317.5379) .. controls
    (256.4735,319.8110) and (249.7688,308.6616) .. (233.2051,293.8177) .. controls
    (230.4594,315.7348) and (246.0514,347.8357) .. (268.3598,352.3633) .. controls
    (289.4143,356.6364) and (309.8624,340.7529) .. (320.4547,314.4145) --
    (332.3256,288.6260) .. controls (328.5031,278.3722) and (320.4810,271.8670) ..
    (312.3378,270.0359) .. controls (311.6076,269.8718) and (308.6141,259.3814) ..
    (307.8849,259.2932) -- cycle;
  \path[draw=cffffff,fill=cd4aa00,line join=miter,line cap=butt,miter
    limit=4.00,line width=0.800pt] (323.9291,289.5565) .. controls
    (322.4034,293.1481) and (321.9990,294.8697) .. (322.1055,297.6126) .. controls
    (332.4869,300.7414) and (343.4642,299.9114) .. (355.2123,302.9763) .. controls
    (341.4526,297.6507) and (332.9854,294.0829) .. (323.9291,289.5565) -- cycle;
  \path[draw=cffffff,fill=cd4aa00,line join=miter,line cap=butt,miter
    limit=4.00,line width=0.800pt] (325.5889,287.6821) .. controls
    (332.2126,289.9994) and (345.7853,290.9803) .. (360.7615,291.6914) .. controls
    (347.8224,293.1534) and (334.8832,294.4899) .. (321.9441,297.5231) .. controls
    (321.3264,293.4098) and (322.6359,290.1724) .. (325.5889,287.6821) -- cycle;
  \path[cm={{0.31949,0.0,0.0,0.31949,(137.95522,206.68169)}},draw=cffffff,fill=ce6e6e6,miter
    limit=4.00,line width=2.504pt] (599.9652,223.4248) .. controls
    (599.9652,235.0301) and (590.5572,244.4381) .. (578.9519,244.4381) .. controls
    (567.3466,244.4381) and (557.9386,235.0301) .. (557.9386,223.4248) .. controls
    (557.9386,211.8195) and (567.3466,202.4116) .. (578.9519,202.4116) .. controls
    (590.5572,202.4116) and (599.9652,211.8195) .. (599.9652,223.4248) -- cycle;
  \path[cm={{0.31949,0.0,0.0,0.31949,(129.04254,210.15416)}},draw=cffffff,fill=ce6e6e6,miter
    limit=4.00,line width=2.504pt] (599.9652,223.4248) .. controls
    (599.9652,235.0301) and (590.5572,244.4381) .. (578.9519,244.4381) .. controls
    (567.3466,244.4381) and (557.9386,235.0301) .. (557.9386,223.4248) .. controls
    (557.9386,211.8195) and (567.3466,202.4116) .. (578.9519,202.4116) .. controls
    (590.5572,202.4116) and (599.9652,211.8195) .. (599.9652,223.4248) -- cycle;
  \path[cm={{0.1486,0.0,0.0,0.1486,(231.28032,249.86205)}},fill=black,miter
    limit=4.00,line width=2.692pt] (599.9652,223.4248) .. controls
    (599.9652,235.0301) and (590.5572,244.4381) .. (578.9519,244.4381) .. controls
    (567.3466,244.4381) and (557.9386,235.0301) .. (557.9386,223.4248) .. controls
    (557.9386,211.8195) and (567.3466,202.4116) .. (578.9519,202.4116) .. controls
    (590.5572,202.4116) and (599.9652,211.8195) .. (599.9652,223.4248) -- cycle;
  \path[cm={{0.1486,0.0,0.0,0.1486,(240.31044,245.13093)}},fill=black,miter
    limit=4.00,line width=2.692pt] (599.9652,223.4248) .. controls
    (599.9652,235.0301) and (590.5572,244.4381) .. (578.9519,244.4381) .. controls
    (567.3466,244.4381) and (557.9386,235.0301) .. (557.9386,223.4248) .. controls
    (557.9386,211.8195) and (567.3466,202.4116) .. (578.9519,202.4116) .. controls
    (590.5572,202.4116) and (599.9652,211.8195) .. (599.9652,223.4248) -- cycle;
  \path[draw=cffffff,line join=miter,line cap=butt,miter limit=4.00,line
    width=0.800pt] (300.1037,315.6400) .. controls (287.8328,318.2553) and
    (275.1459,322.5546) .. (262.3338,327.3608) .. controls (275.7810,328.9550) and
    (288.6820,325.6630) .. (296.9479,324.8613);
  \path[draw=cffffff,line join=miter,line cap=butt,miter limit=4.00,line
    width=0.800pt] (282.2825,326.9011) .. controls (270.0840,329.9580) and
    (276.1990,328.2779) .. (263.3869,333.0842) .. controls (276.8341,334.6784) and
    (289.7352,331.3864) .. (298.0011,330.5847);
  \path[draw=cffffff,line join=miter,line cap=butt,miter limit=4.00,line
    width=0.800pt] (280.3354,333.0049) .. controls (268.4665,336.6880) and
    (274.4737,334.3442) .. (261.6616,339.1504) .. controls (275.1088,340.7446) and
    (288.0099,337.4526) .. (296.2758,336.6509);
  \path[draw=cffffff,fill=cd4aa00,line join=miter,line cap=butt,miter
    limit=4.00,line width=0.800pt] (278.7791,346.3180) .. controls
    (278.6245,353.9711) and (277.6574,359.1640) .. (275.8380,369.3284) .. controls
    (275.1448,373.2010) and (278.0764,376.5585) .. (281.8824,379.4656) .. controls
    (287.1509,378.9140) and (291.1905,377.0586) .. (293.2211,373.0712) .. controls
    (285.9168,368.7832) and (282.9316,368.8531) .. (279.0689,368.0375) .. controls
    (279.4381,361.2676) and (281.8373,353.0398) .. (285.2591,347.3937) -- cycle;

\end{tikzpicture}
}
     
\newcommand{\drawflower}{%
\begin{tikzpicture}[y=0.80pt, x=0.8pt,yscale=-1, inner sep=0pt, outer sep=0pt]
  \path[draw=cffffff,fill=cffcc00,line join=miter,line cap=butt,miter
    limit=4.00,line width=0.312pt] (410.2849,188.5512) .. controls
    (407.5584,180.4212) and (407.4439,177.8624) .. (413.2692,172.2733) .. controls
    (415.9921,179.2938) and (414.4537,184.7208) .. (410.2849,188.5512) -- cycle;
  \path[draw=cffffff,fill=cffcc00,line join=miter,line cap=butt,miter
    limit=4.00,line width=0.312pt] (410.3118,188.5073) .. controls
    (412.6631,180.2609) and (414.0163,178.0863) .. (421.9817,176.7732) .. controls
    (420.2552,184.1027) and (415.9163,187.7072) .. (410.3118,188.5073) -- cycle;
  \path[draw=cffffff,fill=c008000,line join=miter,line cap=butt,miter
    limit=4.00,line width=0.448pt] (408.7096,186.9043) .. controls
    (411.7294,200.3069) and (414.0449,208.2411) .. (410.1551,221.2489) --
    (410.5294,224.3181) .. controls (417.5395,211.0431) and (412.4754,200.0296) ..
    (409.6828,186.7546) -- cycle;
  \path[draw=cffffff,fill=cffcc00,line join=miter,line cap=butt,miter
    limit=4.00,line width=0.312pt] (410.2711,188.4376) .. controls
    (416.6007,182.6526) and (418.8939,181.5117) .. (426.3632,184.5748) .. controls
    (421.0466,189.9074) and (415.4615,190.6982) .. (410.2711,188.4376) -- cycle;
  \path[draw=cffffff,fill=cffcc00,line join=miter,line cap=butt,miter
    limit=4.00,line width=0.312pt] (410.2838,188.4357) .. controls
    (410.4557,180.1670) and (409.8253,177.7785) .. (402.8551,174.3084) .. controls
    (402.3674,181.5547) and (405.3445,186.1083) .. (410.2838,188.4357) -- cycle;
  \path[draw=cffffff,fill=cffcc00,line join=miter,line cap=butt,miter
    limit=4.00,line width=0.312pt] (410.3411,188.3830) .. controls
    (406.1475,181.2547) and (404.3572,179.5525) .. (396.6030,180.2572) .. controls
    (399.9911,186.6811) and (404.9152,188.9945) .. (410.3411,188.3830) -- cycle;
  \path[draw=cffffff,fill=cffcc00,line join=miter,line cap=butt,miter
    limit=4.00,line width=0.312pt] (410.2149,188.4653) .. controls
    (403.0173,184.3915) and (400.6156,183.8135) .. (394.2543,188.3034) .. controls
    (400.4020,192.1702) and (405.8229,191.7095) .. (410.2149,188.4653) -- cycle;
  \path[draw=cffffff,fill=cffcc00,line join=miter,line cap=butt,miter
    limit=4.00,line width=0.312pt] (410.3179,188.5072) .. controls
    (402.0478,188.5808) and (399.6790,189.2819) .. (396.4174,196.3520) .. controls
    (403.6749,196.6244) and (408.1382,193.5134) .. (410.3179,188.5072) -- cycle;
  \path[draw=cffffff,fill=cffcc00,line join=miter,line cap=butt,miter
    limit=4.00,line width=0.312pt] (410.2261,188.4017) .. controls
    (403.2555,192.8527) and (401.6198,194.7039) .. (402.6071,202.4273) .. controls
    (408.9030,198.8069) and (411.0352,193.8017) .. (410.2261,188.4017) -- cycle;
  \path[draw=cffffff,fill=cffcc00,line join=miter,line cap=butt,miter
    limit=4.00,line width=0.312pt] (410.3527,188.3110) .. controls
    (407.2318,195.9700) and (406.9652,198.4259) .. (412.2310,204.1615) .. controls
    (415.2807,197.5703) and (414.1314,192.2526) .. (410.3527,188.3110) -- cycle;
  \path[draw=cffffff,fill=cffcc00,line join=miter,line cap=butt,miter
    limit=4.00,line width=0.312pt] (410.2918,188.3313) .. controls
    (411.2358,196.5477) and (412.1824,198.8294) .. (419.5566,201.3285) .. controls
    (419.0634,194.0827) and (415.4998,189.9718) .. (410.2918,188.3313) -- cycle;
  \path[draw=cffffff,fill=cffcc00,line join=miter,line cap=butt,miter
    limit=4.00,line width=0.312pt] (410.3995,188.4214) .. controls
    (415.4078,195.0031) and (417.3870,196.4813) .. (425.0033,194.8633) .. controls
    (420.8782,188.8858) and (415.7148,187.1718) .. (410.3995,188.4214) -- cycle;
  \path[cm={{0.10683,0.0,0.0,0.10578,(384.1619,152.65683)}},draw=cffffff,fill=caa8800,miter
    limit=4.00,line width=2.932pt]
    (302.8891,337.9617)arc(-0.011:180.011:57.096)arc(-180.011:0.011:57.096) --
    cycle;
  \path[draw=cffffff,fill=c008000,line join=miter,line cap=butt,miter
    limit=4.00,line width=0.448pt] (414.2853,212.8269) .. controls
    (418.8318,207.9529) and (417.5412,206.7992) .. (423.4821,208.6793) .. controls
    (419.0129,211.6273) and (419.2511,213.6545) .. (414.2853,212.8269) -- cycle;
  \path[draw=cffffff,fill=c008000,line join=miter,line cap=butt,miter
    limit=4.00,line width=0.448pt] (411.7135,211.8755) .. controls
    (408.0230,207.9193) and (409.0706,206.9829) .. (404.2484,208.5089) .. controls
    (407.8760,210.9018) and (407.6827,212.5473) .. (411.7135,211.8755) -- cycle;

\end{tikzpicture}
}
     
\newcounter{myflowers}

\newcommand{\flowers}[1]{%
\setcounter{myflowers}{-1}\loop\stepcounter{myflowers}\ifnum\value{myflowers} < #1 \drawflower\repeat%
}

\makechapterstyle{weloveducks}{%
\chapterstyle{default}
\renewcommand*{\chapnamefont}{\color{olive}\bfseries\HUGE}
\renewcommand*{\chaptitlefont}{\hfill\bfseries\HUGE}
\renewcommand*{\printchapternum}{\chapnamefont\thechapter\xspace\flowers{\thechapter}}
\renewcommand*{\printchaptertitle}[1]{%
\drawduck\bfseries\HUGE\hfill ##1%
}}
