Advanced

Re: Checker CSS and helper functions

Checker CSS and helper functions
January 29, 2026 10:34PM
Today we accidentally slipped out the upcoming CSS changes for challenge checkers. And also some helper functions that can be used.

The upside with this is that the checker output won't be affected by CSS changes on the site itself in the same way as before. It should also be easier to make a more unified look of things.

(Note to self: Issue #238, dev3 scriptId 13758)



Edited 2 time(s). Last edit at 01/31/2026 10:07AM by magma1447. (view changes)
Re: Checker CSS and helper functions
January 29, 2026 10:34PM
Helper functions

  • PGC.Icon.GeocacheType(type) - Returns an icon as an <i> html tag.
  • PGC.Icon.GeocacheSize(size) - Returns an icon as an <i> html tag.
  • PGC.Icon.GeocacheFound() - Returns an icon as an <i> html tag.
  • PGC.Icon.GeocacheOwned() - Returns an icon as an <i> html tag.
  • PGC.Icon.Challenge() - Returns an icon as an <i> html tag.
  • PGC.Icon.Check(large) - Returns an icon as an <i> html tag. Defaults to 16px, make large true to get 32px.
  • PGC.Icon.Stop(large) - Returns an icon as an <i> html tag. Defaults to 16px, make large true to get 32px.
  • PGC.Icon.CountryFlag(countryName) - Returns a flag icon as an <img> html tag.
  • PGC.Icon.Attribute(int|string attribute, null|'yes'|'no' state) - Returns an icon as an <img> html tag.



Edited 1 time(s). Last edit at 01/29/2026 10:42PM by magma1447. (view changes)
Re: Checker CSS and helper functions
January 29, 2026 10:34PM
CSS Classes

Table styles
  • table-bordered
  • table-striped
  • table-condensed

Coloring

Background colors
  • bg-primary
  • bg-secondary
  • bg-success
  • bg-danger
  • bg-warning
  • bg-info
  • bg-light
  • bg-dark

Text colors
  • text-primary
  • text-secondary
  • text-success
  • text-danger
  • text-warning
  • text-info
  • text-light
  • text-dark

Text formatting
  • align-left
  • align-center
  • align-right
  • text-small (87.5%)
  • text-smaller (75.0%)
  • text-monospace
  • text-monospace-narrow



Edited 4 time(s). Last edit at 01/30/2026 08:59AM by magma1447. (view changes)
Re: Checker CSS and helper functions
January 29, 2026 10:34PM
Code Example

local args = {...}
local conf = args[1].config
local profileName = args[1].profileName
local profileId = args[1].profileId
local gccode = args[1].gccode -- gccode from the tag


ok = true;

local html = {}

table.insert(html, "<p>Geocache type icon</p>")
table.insert(html, PGC.Icon.GeocacheType('Traditional Cache'))

table.insert(html, "<p>Geocache size icon</p>")
table.insert(html, PGC.Icon.GeocacheSize('Large'))

table.insert(html, "<p>Found/owned</p>")
table.insert(html, PGC.Icon.GeocacheFound())
table.insert(html, PGC.Icon.GeocacheOwned())

table.insert(html, "<p>Misc</p>")
table.insert(html, PGC.Icon.Challenge())
table.insert(html, PGC.Icon.Check())
table.insert(html, PGC.Icon.Stop())
table.insert(html, PGC.Icon.Check(true))
table.insert(html, PGC.Icon.Stop(true))

table.insert(html, "<p>Flags</p>")
table.insert(html, PGC.Icon.CountryFlag('Sweden'))
table.insert(html, PGC.Icon.CountryFlag('United States'))
table.insert(html, PGC.Icon.CountryFlag('Ukraine'))

table.insert(html, "<p>Attributes</p>")
table.insert(html, PGC.Icon.Attribute(29))
table.insert(html, PGC.Icon.Attribute('Telephone nearby'))
table.insert(html, PGC.Icon.Attribute('Telephone nearby', 'yes'))
table.insert(html, PGC.Icon.Attribute('Telephone nearby', 'no'))


-- Showing CSS
table.insert(html, "<h3>Tables</h3>")

table.insert(html, "<h4>Basic table</h4>")
table.insert(html, "<table><tr><th>Header 1</th><th>Header 2</th><th>Header 3</th></tr><tr><td>Cell A1</td><td>Cell A2</td><td>Cell A3</td></tr><tr><td>Cell B1</td><td>Cell B2</td><td>Cell B3</td></tr></table>")

table.insert(html, "<h4>Bordered table</h4>")
table.insert(html, "<table class=\"table-bordered\"><tr><th>Header 1</th><th>Header 2</th><th>Header 3</th></tr><tr><td>Cell A1</td><td>Cell A2</td><td>Cell A3</td></tr><tr><td>Cell B1</td><td>Cell B2</td><td>Cell B3</td></tr></table>")

table.insert(html, "<h4>Striped rows</h4>")
table.insert(html, "<table class=\"table-striped\"><tbody><tr><th>Header 1</th><th>Header 2</th><th>Header 3</th></tr><tr><td>Row 1 Col 1</td><td>Row 1 Col 2</td><td>Row 1 Col 3</td></tr><tr><td>Row 2 Col 1</td><td>Row 2 Col 2</td><td>Row 2 Col 3</td></tr><tr><td>Row 3 Col 1</td><td>Row 3 Col 2</td><td>Row 3 Col 3</td></tr></tbody></table>")

table.insert(html, "<h4>Striped columns</h4>")
table.insert(html, "<table class=\"table-striped-columns\"><tr><th>Header 1</th><th>Header 2</th><th>Header 3</th><th>Header 4</th></tr><tr><td>Row 1 Col 1</td><td>Row 1 Col 2</td><td>Row 1 Col 3</td><td>Row 1 Col 4</td></tr><tr><td>Row 2 Col 1</td><td>Row 2 Col 2</td><td>Row 2 Col 3</td><td>Row 2 Col 4</td></tr></table>")

table.insert(html, "<h3>Colors</h3>")
table.insert(html, "<p><span class=\"bg-primary text-light\">Primary</span> <span class=\"bg-secondary text-light\">Secondary</span> <span class=\"bg-success text-light\">Success</span> <span class=\"bg-danger text-light\">Danger</span></p>")
table.insert(html, "<p><span class=\"bg-warning text-dark\">Warning</span> <span class=\"bg-info text-dark\">Info</span> <span class=\"bg-light text-dark\">Light</span> <span class=\"bg-dark text-light\">Dark</span></p>")

table.insert(html, "<h3>Text colors</h3>")
table.insert(html, "<p><span class=\"text-primary\">Primary text</span> <span class=\"text-success\">Success text</span> <span class=\"text-danger\">Danger text</span> <span class=\"text-warning\">Warning text</span></p>")

table.insert(html, "<h3>Text alignment</h3>")
table.insert(html, "<p class=\"align-left\">Left aligned text</p>")
table.insert(html, "<p class=\"align-center\">Center aligned text</p>")
table.insert(html, "<p class=\"align-right\">Right aligned text</p>")

table.insert(html, "<h3>Text utilities</h3>")
table.insert(html, "<p>Normal text and <span class=\"text-small\">smaller text</span></p>")
table.insert(html, "<p class=\"text-monospace\">This is monospace text for code examples</p>")
-- end CSS


html = table.concat(html, "\n")


return { ok = ok, log = log, html = html }



Edited 2 time(s). Last edit at 01/29/2026 10:46PM by magma1447. (view changes)
Re: Checker CSS and helper functions
January 29, 2026 10:37PM
Re: Checker CSS and helper functions
January 31, 2026 08:50AM
I tested a bit and found 2 problems:
PGC.Icon.GeocacheType("Cache In Trash Out Event") does not work.
There is a typo in pgc-challenge-checkers.css: It defines "geocache-type-cacheintrashouteevent" with a double "e" for "event".

PGC.Icon.GeocacheSize() is not usable. The icons are shown massively distorted as 16x16 pixels.
Re: Checker CSS and helper functions
January 31, 2026 10:13AM
KaiserVonChina Wrote:
-------------------------------------------------------
> I tested a bit and found 2 problems:
> PGC.Icon.GeocacheType("Cache In Trash Out Event")
> does not work.
> There is a typo in pgc-challenge-checkers.css: It
> defines "geocache-type-cacheintrashouteevent" with
> a double "e" for "event".
>
> PGC.Icon.GeocacheSize() is not usable. The icons
> are shown massively distorted as 16x16 pixels.

You are right on both accounts. I have fixed the spelling error, and changed the size of the `size` classes from 16x16 to 45x12, as the images are. Impressive that no one noticed the shrunk size images in the screenshots before (during development).

If there is any feedback regarding naming conventions, or missing css classes feedback is welcome. The sooner the better. Rather change things before there is too many scripts using it.

EDIT: I have changed this in DEV, but not in production yet. But I think I will prepare a release soon to be honest. I just have a few more emails and similar to go through from the last ~12 hours.



Edited 1 time(s). Last edit at 01/31/2026 10:14AM by magma1447. (view changes)
Re: Checker CSS and helper functions
February 07, 2026 10:47PM
Sorry, my fault.
The browser scaling was not set to 100%



Edited 1 time(s). Last edit at 02/07/2026 10:49PM by KaiserVonChina. (view changes)
Re: Checker CSS and helper functions
February 08, 2026 06:53PM
Hi, sorry if these have been answered elsewhere in the forum, but I am a bit out of the loop :)
Someone let me know that a checker of mine wasn't displaying colours correctly with the old html (<font color='red'> etc.). I have changed it to the one above (<span class='text-danger'> etc.) and it now displays correctly. However, you can no longer paste results into an excel spreadsheet as some like to do, with the colours copying over correctly (they just all turn black without <font>).
I guess my question is if <font> is now obsolete or changed, and so should checkers be changed? Sorry if I'm missing something!!
Re: Checker CSS and helper functions
February 08, 2026 07:22PM
The HTML tag `<font>` has been deprecated since 1999 actually, with the release of HTML 4.0.1. :)

You could use `style="font-color: red;"`, that probably would work when copying to a spread sheet. But the challenge checker system itself isn't really built with that in mind. In general "modern" HTML works with CSS, and copying HTML without the CSS itself doesn't make much sense. What you are asking for isn't something that can be solved automatically with good structured HTML from ~2010 and forward, from what I know.

We for sure haven't had this case in mind when redesigning. I didn't even know people did this (copied the output into spreadsheets) to be honest.
Re: Checker CSS and helper functions
February 08, 2026 07:31PM
Thanks, that works perfectly - I think I must not be as familiar with HTML as I thought!!
I don't use Excel myself but I have happened to have a couple conversations with people that did, particularly when the checkers track progress over a big table.
Re: Checker CSS and helper functions
February 08, 2026 07:54PM
In theory we could build a process to export the checker output to pure html+style, without CSS. Similar to how one can download Profile stats or place it in the Geocaching dot com profile. But honestly, don't expect it any time soon. At the earlier after you see that the whole Challenge checker pages have had a complete rewrite from scratch, and maybe not even then.

But what basically would be needed would be to take that html and css and convert the css into style attributes.

PS! Don't worry about being outdated regarding HTML. I am ancient in that regard myself. At least consider the fact that I partly work with that part. Part by part Project-GC is getting a rewrite and becoming more and more modern, but it's a lot of code.
Re: Checker CSS and helper functions
February 14, 2026 10:51AM
I tried some more to update my scripts with the new CSS classes.
However, I still don't manage to get tables with "1px solid black" borders using CSS classes.

Class "table-bordered" uses some light gray border which is very similar to the background color I use for my table header and just looks ugly. I didn't find anything for black border.

I tried switching on borders with your class and then to override the border style and make it inherited to the TDs like this, but it did not work:
<table class="table-bordered" style="border: 1px solid black; border-collapse: collapse; width: auto;">

Also I did not find any class for my table that would make the <TH> and <TD> elements use "text-align: center". That would be really helpful, because otherwise I need to define it again on every single cell.

Also can you please make "width: auto;" the default for tables? Your default "width: 100%;" is breaking the output for many scripts.
If we really want a table to use the full width, we can switch it on. Otherwise we would like e.g. a DT grid to be squared and not take the full width of the screen.



Edited 1 time(s). Last edit at 02/14/2026 06:11PM by KaiserVonChina. (view changes)
Re: Checker CSS and helper functions
February 14, 2026 08:56PM
Quote

However, I still don't manage to get tables with "1px solid black" borders using CSS classes.

I guess we can't have a rule for all variants really. Could you show me a good example of where it's needed? A part of the goal is to get a more unified look, while the primary goal was to detached from leaked CSS which can't be trusted to be used. But it feels to me that most tables should be able to use the same border colors. Black borders feels a bit 90s?

Quote

I tried switching on borders with your class and then to override the border style and make it inherited to the TDs like this, but it did not work

I don't think `style border` works on a table element. A table itself doesn't have a border, the cells does. That's the power of CSS, the class can be added to the table and the css rule can target `table>tr>td`.

I am not against improving the CSS, I just need to understand why we are doing changes and for what purpose. I believe that default border colors should be as they are in the CSS. A table header normally is covered by using th, while the body uses td. The css of those should cover the standard. Alternatively we could add thead, tbody and tfooter tags as well, though I bet most won't use them.

Quote

Also I did not find any class for my table that would make the <TH> and <TD> elements use "text-align: center". That would be really helpful, because otherwise I need to define it again on every single cell.
`.align-center` can be used on `th` and `td`. It would however require the class to be added to all of them. I'll make sure to add a new CSS rule so that `aligne-left|center-right` can be added on a `table` or `tr` as well. Release expected late Wednesday CET (like 8-10 pm).

Quote

Also can you please make "width: auto;" the default for tables? Your default "width: 100%;" is breaking the output for many scripts.
I will make sure that we change the 100% to auto as well. At the same time I will add:
table.full-width {
    width: 100%;
}
Re: Checker CSS and helper functions
February 14, 2026 10:24PM
Thanks for the changes you plan to do.

Here is how my table looks like with your class "table-bordered":

Notice that everything is left-aligned and how badly the border is visible between the cache types.

Here is how I would like it to look like:


A "one size fits all" design is a nice idea, but it will never fit all requirements of real life. Sure you can't provide classes for every possible variant, but having more than one option to choose from would be nice.

Here is another example where I use 2 different color sets for a striped table:

I'm pretty sure that the background colors can't be fit into a CSS class, since I'm using "rowspan" with different numbers of rows here and those numbers are not fixed but depend on values from the tag configuration. But again I can't imagine which sets of background colors would fit nicely to your light-gray border color in such a table.

P.S.: If you would like a more uniform design, you can define background colors for table cells that are
- not fulfilled (usually red is used in checkers so far)
- partially fulfilled (usually some kind of yellow or orange))
- fulfilled (some kind of green)
- fulfilled and selected (some other kind of green)

Example: Find some number of unique pairs of A and B with at least C caches that have both properties A and B.
Table cells with less than C caches would be "partially fulfilled", table cells with at least C caches would be "fulfilled". Table cells with at least C caches that are selected as unique pairs would be "fulfilled and selected".
Table cells that are not considered or empty usually keep their default (white) background.



Edited 1 time(s). Last edit at 02/14/2026 11:19PM by KaiserVonChina. (view changes)
Re: Checker CSS and helper functions
February 19, 2026 11:46PM
Thank you for the design update.
Output of old checker scripts now looks much better again with tables that are no longer strechted to 100% width.

I tested a bit more with "<table class="table-bordered align-center">".
The "align-center" works nicely for <TD>s, but not for <TH>s:


Also I'm still struggling to find background colors that work with your border color.
Your very light gray border may be OK for a white background, but with colored backgrounds it is barely visible. I still think we need something darker here.

@magma1447
In case you want to see the original output, you can run this test checker: https://project-gc.com/Challenges//94698



Edited 1 time(s). Last edit at 02/20/2026 07:42AM by KaiserVonChina. (view changes)
Re: Checker CSS and helper functions
February 20, 2026 09:28AM
I just wanted to say that I haven't forgotten or ignored this. I will get back to it next week (not Monday). I have been busy with other scheduled stuff.

Just FYI - The colors in the CSS are same/similar to Bootstrap's colors. I generally think that their borders are great. But I can also agree to that very distinct borders could be useful when doing a report with data in it, and not just having some "html content". Updates will follow.
Re: Checker CSS and helper functions
February 23, 2026 03:03PM
Sure, take your time. I just wanted to give early feedback so that you can better understand our use cases and requirements.
No need to hurry with a design.

In the meantime I compared a bit more our different grids (i.e. DT, calendar, and others) and I think we need a few more colors:
- a color for grid headers (top and left edge of a grid), i.e. light gray
- a color for excluded or non-existing grid cells (like February 30/31 in a calendar grid), i.e. slightly darker gray
- colors for failed / partially passed (in progress) / passed / passed and selected
- a second color pair for failed / passed to visualize a different condition in another part of the same grid

"passed and selected" could for instance be used to highlight unique pairs of X and Y values or to visualize a streak in a calendar grid.

I also had a lengthy discussion with ChatGPT about color blindness. The most common color blindness is red-green-blindness. So a red-yellow-green color scheme for failed / in progress / passed is pretty common, but may pose a problem for color blind people.

ChatGPT claims that this color scheme works very well for all common kinds of color blindness.
Since I don't know any color-blind people in real life, I couldn't collect feedback how well these colors really work.



For sure you need to get used to these colors if you expect red/green, but the scheme is not hard to understand:
- lightest color = failed
- slightly darker color = in progress
- medium dark color = passed
- even darker amber color = passed and selected

In this example color set 1 (yellow / orange / amber) is used for the cells in a DT grid, while color set 2 (blue) is used to visualize whether the sum of the cells in a line has reached a required minimum. The different color set is necessary to have a clear visual distinction between DT grid cells and cells with sums.

Update: after doing a bit more research on this topic, it seems that those color enhancements are done on client side (i.e. via operating system settings). It doesn't seem to be common that a server delivers such optimized colors on demand.
I like the red/yellow/green color scheme better anyways.



Edited 1 time(s). Last edit at 02/25/2026 03:35PM by KaiserVonChina. (view changes)
Re: Checker CSS and helper functions
March 04, 2026 11:25AM
Sorry for taking so long to answer. I had this on my list last Tuesday but didn't manage to catch up.

Quote

Notice that everything is left-aligned...

Web browser defaults are center-aligned for th and left-aligned for td. The provided CSS sets everything to left-aligned for consistency.

The idea then was that a `align-center` on the table element should fix the whole table. But when looking at it it doesn't override the `th` css. This will be fixed in the next release. This was a bug and not intentional.

Quote

... and how badly the border is visible between the cache types.

We'll be adding class `table-bordered-black` in the next release. You will then end up with border colors using `#333` (so "almost black").

Quote

P.S.: If you would like a more uniform design, you can define background colors for table cells that are
- not fulfilled (usually red is used in checkers so far)
- partially fulfilled (usually some kind of yellow or orange))
- fulfilled (some kind of green)
- fulfilled and selected (some other kind of green)

The idea is that these should be used:
- primary
- secondary
- success
- danger
- warning
- info
- light
- dark

I guess we could have "aliased" them into words that fits expected challenge checker result names better though. And potentially adjusted the colors as well if needed. I expect `warning` to look a bit light. Is it your opinion that the above doesn't work well enough? I think Project-GC itself uses those almost exclusivily.

Quote

I tested a bit more with "<table class="table-bordered align-center">".
The "align-center" works nicely for <TD>s, but not for <TH>s:

Covered above.

Quote

Also I'm still struggling to find background colors that work with your border color.
Your very light gray border may be OK for a white background, but with colored backgrounds it is barely visible. I still think we need something darker here.

Covered above (`table-bordered-black`).

Quote

Sure, take your time. I just wanted to give early feedback so that you can better understand our use cases and requirements.

And this is much appreciated. Don't take my response time as if it's not wanted feedback. It's just that it's always something to do, everywhere. :)

Quote

In the meantime I compared a bit more our different grids (i.e. DT, calendar, and others) and I think we need a few more colors

If the colors listed above doesn't work well. Feel free to submit a list of colors (#rrggbb(aa)) and name suggestions and I can try to figure out how we should implement them in the css.

Jumping a step forward here, but if you wish for a color-blind variant of it, make such suggestion as well. If we add one "theme" we can just as well add a second. I don't know if you know it, but there is a color-blind boolean sent as an argument to the LUA scripts. Print the incoming `args` and you should find it.

Quote

So a red-yellow-green color scheme for failed / in progress / passed is pretty common, but may pose a problem for color blind people

Project-GC itself has a "modifier class" that we add to get other colors. It's only used in a few places, for several reasons. It's hard to find colors that work out. We seldom think of it. There are so many variants of color blindness. Back in the day we used to get a lot of contradicting feedback regarding our colors. It's very time-consuming.

I think the colors on your "colorful" table looks great. I personally have a very hard time guessing what they represent though (if I don't look at your "legend").



I hope I didn't miss anything important. If so, just repeat it.



Edited 1 time(s). Last edit at 03/04/2026 11:26AM by magma1447. (view changes)
Re: Checker CSS and helper functions
March 04, 2026 06:42PM
As I wrote in my update I dont think anymore that we have to provide an "enhanced for color blindness" mode. According to my research this is normally done by the users via settings in their operating system and adjusted by them to their needs.

I'll test again how suitable the already defined colors (primary / secondary / success / ...) are once the darker border is available.

Until then I have another small feature request for your next update: in addition to horizontal centering I now came across a use case where vertical centering on TDs and THs is required.
It would be nice to get support for something like
<table class="vertical-align-middle">
which would cause all TDs and THs of the table to use style "vertical-align: middle".
Re: Checker CSS and helper functions
March 04, 2026 08:23PM
Expect `valign-[top|middle|bottom` to exist in next version. Can be applied to table, tr, th, td.
/* Vertical alignment */
#cc_HtmlFeedback table.valign-top th,
#cc_HtmlFeedback table.valign-top td,
#cc_HtmlFeedback table tr.valign-top,
#cc_HtmlFeedback table tr td.valign-top,
#cc_HtmlFeedback table tr th.valign-top {
    vertical-align: top;
}
#cc_HtmlFeedback table.valign-middle th,
#cc_HtmlFeedback table.valign-middle td,
#cc_HtmlFeedback table tr.valign-middle,
#cc_HtmlFeedback table tr td.valign-middle,
#cc_HtmlFeedback table tr th.valign-middle {
    vertical-align: middle;
}
#cc_HtmlFeedback table.valign-bottom th,
#cc_HtmlFeedback table.valign-bottom td,
#cc_HtmlFeedback table tr.valign-bottom,
#cc_HtmlFeedback table tr td.valign-bottom,
#cc_HtmlFeedback table tr th.valign-bottom {
    vertical-align: bottom;
}
Re: Checker CSS and helper functions
March 08, 2026 09:10AM
I now tested how your already defined colors look like with a "table-bordered-black".
While they are nice colors in general, I think they are too dark and therefore provide too little contrast for black text. Also I did not find a nice secondary color pair for failed/success.

Here would be my proposal:


For the light gray header cells on top and left I used your "bg-light". That is maybe OK, but I find it hard to distinguish from a pure white background. A slightly darker #f2f3f5 would look better in my opinion.
For the disabled cells (D1.5/T1.5) I tried "bg-secondary" as the next darker available gray, but I think this is already too dark. A lighter gray #cfd2d6 (in T2) looks better to me.

For the other colors I would suggest:
failed1 = '#f1aeb5',
progress1 = '#ffe69c',
passed1 = '#a9dfbf',
selected1 = '#81c784',

failed2 = '#f8d7da',
progress2 = '#fff3cd',
passed2 = '#d4edda'

The stronger color set 1 would be used most of the time.
The lighter color set 2 would be used only when 2 conditions shall be visualized at the same time, which shouldn't happen too often.
My example is an extreme to demonstrate how all these colors work together. In typical use cases grids will use a smaller subset of the available colors.

"align-center" and "valign-middle" now also seem to work correctly, thanks for the fix!



Edited 1 time(s). Last edit at 03/11/2026 07:43AM by KaiserVonChina. (view changes)
Sorry, you do not have permission to post/reply in this forum.