Use JavaScript to invert colours where possible

The `target` hack will keep working fine on unsupported browsers, but where possible we can use JavaScript to change the colours without having to jump to an anchor.