From Meta, a Wikimedia project coordination wiki
Jump to: navigation, search



I would like to know if it is possible to be able to use Wikimedia projects with the colors reversed - i.e. white text on a black background.

For example, here it says that I can create this page and enter code into it which will allow me to do this. Is this possible? I expect the code could be pretty simple, and revolve around two lines of hex codes where I can play around with the colours of the text and of the background. I am happy with everything else in this user style, and would only like to be able to change the colours from time to time. Could someone please help me do this?

Thanks in advance! BigSteve (talk) 19:50, 10 March 2014 (UTC)

There is no simple way to invert colors with CSS only. You can look at this and this. Ruslik (talk) 18:54, 11 March 2014 (UTC)
OK, I read through them, but as far as I can see this is to do with entering code on your own blog page. But again, here it says you can create your own user style in your own user space - and all I want for "my user style" is to be able to choose what colour my background is and what colour my text is, perhaps using hex codes. I wouldn't have thought that would be any more difficult than any other "user style"...? BigSteve (talk) 11:12, 12 March 2014 (UTC)
Here is a very basic CSS code you can use: Insert something like #mw-content-text {color:white; background-color:black;} into Special:Mypage/common.css. Do note that colors of the hyperlinks cannot changed by this code (that can be provided, if needed) and appearance is rather ugly, in my opinion. You can also use hex codes instead of color names. --Glaisher [talk] 11:57, 12 March 2014 (UTC)
Brilliant, thanks! For the minute that's fine, I'll work on refining it in due course :) BigSteve (talk) 13:48, 13 March 2014 (UTC)
See also w:en:MediaWiki:Gadget-Blackskin.css. 20:51, 13 March 2014 (UTC)
Thanks! That's even better :) BigSteve (talk) 08:41, 14 March 2014 (UTC)

Local variables in page or template[edit]

Is there a way to create/use local variables in a page or template ?
(Maybe I should say local constants, since they wouldn't be changing.)
The idea is to reduce edit errors, and hopefully reduce the footprint for repetitive text, which sometimes can be quite long.
This can make a considerable difference on pages where the text is used many times.
A form like $const; would be much better than something like "very_long_obscure_description_of_something" repeated many times
My use case is essentially in links. Alternatives such as shortcuts work fairly well (with some minor drawbacks), but over vigilant rule enforcers attack unconventional uses permitted by the guidelines. Local variables (or constants) would avoid all drawbacks, as well as being useful for other purposes.
If good programming style is used, using such a feature (when appropriate) would help maintain pages.
Thanks in advance for any info, suggestions or ideas. André437 (talk) 04:33, 18 March 2014 (UTC)

If you are creating a complicated template, you should consider using Scribunto (which uses the Lua programming language). There is no exact way to define constants in template code, but here is a hack that would do something similar: you have a "main" template and a "helper" template. The main template code looks like {{helper|myconstant=someexpression|otherthing=foo|foo=bar|...}}, and the helper code uses {{{myconstant}}}, {{{otherthing}}}, {{{foo}}} to access these parameters. Regards, PiRSquared17 (talk) 15:42, 18 March 2014 (UTC)
Thanks for your suggestions.
Could you give me hints in using Scribunto/Lua with a WP page ? Would that require writing a module to which the desired text is passed (or integrated) ? If so, I don't see how that would help in my case, unless I can use it to set a value that would be accessible and persistant after exiting. (My idea being to set the value at the top of the page, to be potentially used at numerous points in the rest of the page.)
As for the second idea, maybe I could just define a template which IS the constant wanted. It seems simpler than cascading transclusion. (But hopefully some overzealous rule enforcer doesn't decide that that would break their idea of how one should apply the guidelines.)
Ideally, there will be some extension or method that gives constants more directly, to avoid polluting common space by something only needed inside a single page. It would also be more self-documenting.
Also, do you know of tools that would let me analyze the footprint of a page with its' transclusions ? I'm trying to minimize the transclusion size of a large page so as to speed up editing and viewing, as well as reducing typos in editing.
Thanks again André437 (talk) 05:15, 19 March 2014 (UTC)
On reflection (and reading a little more documentation), I realise that I should be able to use a module already used by the template concerned, just modifying it to let me pass it a new variable, before using it in subsequent passes. I just have to learn a little more lua syntax.
Thanks again :) André437 (talk) 15:11, 20 March 2014 (UTC) not loading[edit] seems to be unresponsive. PiRSquared17 (talk) 18:50, 31 March 2014 (UTC)

Confirming on my end. — TBloemink talk 18:53, 31 March 2014 (UTC)
see bugzilla:63315. If you clear all your cookies and surf as anon you may still see something ;) btw: ssl/https support isn't working at the moment, different issue) --Se4598 (talk) 19:10, 31 March 2014 (UTC)