 PRIVATE>
 
 : post. ( post index -- )
-    "%2d. " sprintf write-text {
+    write-number
+    {
         [ [ "title" of ] [ "url" of ] bi write-title ]
         [ post>url host>> " (" ")" surround write-text nl ]
         [ "score" of "    %d points" sprintf write-text ]

io.styles json.reader kernel make math sequences ui urls ;

IN: hacker-news

<PRIVATE
: hacker-news-ids ( endpoint -- ids )

: hacker-news-job-stories ( n -- seq )
    "jobstories" hacker-news-items ;

: christmas-day? ( -- ? )
    now dup christmas-day same-day? ;

: number-color ( n -- color )
    christmas-day? [
        odd? christmas-red christmas-green ?
    ] [
        drop HEXCOLOR: a0a0a0
    ] if ;

: background-color ( -- color )
    christmas-day? HEXCOLOR: bc2c21 HEXCOLOR: ff6600 ? ;

: write-number ( n -- )
    [ "%2d. " sprintf H{ } clone ] keep
    number-color foreground pick set-at format ;

: write-title ( title url -- )
    '[
        _ presented ,,
