Internal pages: Update directory listing style.

This commit is contained in:
Michael Drake 2020-02-24 18:21:34 +00:00
parent 1e6b0f1d76
commit 52bfae1782
2 changed files with 77 additions and 14 deletions

View File

@ -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,
"</style>\n"
"<title>%s</title>\n"
"<style>\n"
"html {\n"
"\tbackground-color: #%06x;\n"
"}\n"
"body {\n"
"\tcolor: #%06x;\n"
"\tbackground-color: #%06x;\n"
"\tborder-color: #%06x;\n"
"}\n"
"body#dirlist h1 {\n"
"\tborder-color: #%06x;\n"
"}\n"
"body#dirlist a.odd {\n"
"\tbackground-color: #%06x;\n"
"}\n"
"body#dirlist a.even {\n"
"\tbackground-color: #%06x;\n"
"}\n"
"body#dirlist a + a>span {\n"
"\tborder-color: #%06x;\n"
"}\n"
"</style>\n"
"</head>\n"
"<body id=\"dirlist\">\n"
"<h1>%s</h1>\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;

View File

@ -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%;