From 52bfae17822d289dcf16566acfa3eac2539d66d5 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 24 Feb 2020 18:21:34 +0000 Subject: Internal pages: Update directory listing style. --- content/dirlist.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) (limited to 'content') 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; -- cgit v1.2.3