Scribble: customizing table borders

29 views
Skip to first unread message

Shriram Krishnamurthi

unread,
Jul 19, 2020, 3:10:03 PM7/19/20
to Racket Users
It appears that in Scribble, the color of a table's borders (e.g., bottom-border) is fixed: e.g.,

<td style="border-bottom: 1px solid black;"><p>5</p></td>

generated from a program such as

@tabular[#:sep @hspace[2]
         #:row-properties '(() () bottom-border ())
#:style (style "LongMult" null)

I haven't had any luck coming up with the right CSS incantation that would let me override exactly that black and not change anything else.

Yes, I can tag these with a style, as above, which translates into a class name. But because the black setting is most deeply nested, I can't seem to change it at all. For instance,

.LongMult {
    border-bottom: 1px solid red;
}

adds a new red bottom border for the whole table while leaving the intermediate black one intact, while 

.LongMult td {
    border-bottom: 1px solid red;
}

adds a red bottom border to every row except the one that is black (since the generated code presumably overrides the outer CSS). It feels like perhaps this should have been a named and modifiable class in scribble.css rather than a hard-coded constant?

(My central problem is I have a site that is in "dark mode", so the black essentially disappears against the background. So the need to change this color is a functional one, not just aesthetic.)

Any ideas? Thanks!

Shriram

Ryan Kramer

unread,
Jul 19, 2020, 6:56:22 PM7/19/20
to Racket Users
This isn't the most ideal way, but it might work for you:

CSS:

.LongMult td[data-underline="yes"] { border-bottom: 1px solid red; }

Code:

#lang scribble/manual

@(require scribble/core
          scribble/html-properties)

@(tabular
  #:sep @hspace[2]
  #:style (style "LongMult" null)
  #:row-properties (list (list)
                         (attributes '((data-underline . "yes")))
                         (list))
  (list (list @para{a1} @para{a2})
        (list @para{b1} @para{b2})
        (list @para{c1} @para{c2})))

Shriram Krishnamurthi

unread,
Jul 19, 2020, 8:26:02 PM7/19/20
to Ryan Kramer, Racket Users
That did the trick well enough, thank you!!! (I wouldn't mind a cleaner solution, but it gets the job done for now.)
Reply all
Reply to author
Forward
0 new messages