From 52bfae17822d289dcf16566acfa3eac2539d66d5 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 24 Feb 2020 18:21:34 +0000 Subject: [PATCH] Internal pages: Update directory listing style. --- content/dirlist.c | 56 +++++++++++++++++++++++++++++++++++++++++- resources/internal.css | 35 ++++++++++++++++---------- 2 files changed, 77 insertions(+), 14 deletions(-) diff --git a/content/dirlist.c b/content/dirlist.c index 1d7a67e1f..d34d3ffcd 100644 --- a/content/dirlist.c +++ b/content/dirlist.c @@ -28,7 +28,11 @@ #include "utils/nsurl.h" #include "utils/messages.h" +#include "netsurf/types.h" +#include "netsurf/plot_style.h" + #include "content/dirlist.h" +#include "desktop/system_colour.h" static int dirlist_filesize_calculate(unsigned long *bytesize); static int dirlist_filesize_value(unsigned long bytesize); @@ -136,18 +140,68 @@ bool dirlist_generate_hide_columns(int flags, char *buffer, int buffer_length) bool dirlist_generate_title(const char *title, char *buffer, int buffer_length) { + nserror err; int error; + colour bg; + colour fg; + colour odd; + colour even; + colour border; + + err = ns_system_colour_char("Window", &bg); + if (err != NSERROR_OK) { + return false; + } + + err = ns_system_colour_char("WindowText", &fg); + if (err != NSERROR_OK) { + return false; + } + + odd = mix_colour(fg, bg, 0x18); + even = mix_colour(fg, bg, 0x0c); + border = mix_colour(fg, bg, 0x40); + + bg = colour_rb_swap(bg); + fg = colour_rb_swap(fg); + odd = colour_rb_swap(odd); + even = colour_rb_swap(even); + border = colour_rb_swap(border); + if (title == NULL) title = ""; error = snprintf(buffer, buffer_length, "\n" "%s\n" + "\n" "\n" "\n" "

%s

\n", - title, title); + title, even, fg, bg, border, border, odd, + even, border, title); if (error < 0 || error >= buffer_length) /* Error or buffer too small */ return false; diff --git a/resources/internal.css b/resources/internal.css index ded56ee0b..f98f0cc3d 100644 --- a/resources/internal.css +++ b/resources/internal.css @@ -2,13 +2,17 @@ html, body { margin: 0; padding: 0; } +html { + padding: 2em; +} + body { - color: #000; - background-color: #fff; font-family: sans-serif; font-size: 94%; margin: 0 auto; - position: relative; } + position: relative; + border-width: 2px; + border-style: solid; } h1, h2, h3, h4, h5, h6, h7, p, ul, dl, ol, table { margin-left: 5mm; @@ -108,13 +112,13 @@ input.default-action { */ body#dirlist { - background-color: #abf; padding-bottom: 2em; } body#dirlist h1 { padding: 5mm; margin: 0; - border-bottom: 2px solid #bcf; } + border-bottom-width: 2px; + border-bottom-style: solid; } body#dirlist p { padding: 2px 5mm; @@ -126,26 +130,31 @@ body#dirlist div { margin: 5mm auto 2em auto; padding: 0; } -body#dirlist a, strong { +body#dirlist strong { + display: table-row; + margin: 0; + padding: 0; + font-size: 120%; +} + +body#dirlist a { display: table-row; margin: 0; padding: 0; } -body#dirlist a.odd { - background-color: #bcf; } - -body#dirlist a.even { - background-color: #b2c3ff; } - body#dirlist span { display: table-cell; vertical-align: middle; } +body#dirlist a > span { + padding-top: 0.1em; } + body#dirlist em > span { padding-bottom: 1px; } body#dirlist a + a>span { - border-top: 1px solid #9af; } + border-top-width: 1px; + border-top-style: solid; } body#dirlist a { background-position: 4px 50%;