Jump to content

Talk:Codex

Add topic
From mediawiki.org

How to use Codex styles in a user script

[edit]

With my very limited CSS/JS experience, I recently tried to make use of Codex styles (some predefined background colors) in a user script, in order to make it fit for use with dark mode in Vector-2022. This was relatively easy, as the predefined variables are readily available and I just needed to replace the hard-coded background colors with fitting variables from Codex.

Then someone else complained that they do not see any background colors anymore, related to my change. Turns out that Codex is apparently not being included in all skins for whatever reason, specifically not in legacy Vector from 2010. Do we have a comprehensive overview in which skins Codex is included?

Anyways, I am now trying to fix this situation, but given the examples on Codex and on the docs, I am not really sure what the best option is to include Codex styles for editors with legacy skins. Specifically, let's assume there is a user script (in user space) in which I want to use for instance .some_class { background-color: var(--background-color-content-added); } — how to I make sure that --background-color-content-added is actually available?

Thanks in advance! —MisterSynergy (talk) 22:32, 3 January 2025 (UTC)Reply

@MisterSynergy Codex is currently only available in Vector 2022 and MinervaNeue (and several 3rd party skins). The best way to deal with this is to have the variable specify a fallback value like: .some_class { background-color: var(--background-color-content-added, original-value-you-are-replacing); }TheDJ (Not WMF) (talkcontribs) 12:25, 5 March 2025 (UTC)Reply

Replacement of OOUI

[edit]

What is the timeframe of the replacement of OOUI with Codex? Just so I can update the notice at the top of the page OOUI to give better context, according to WikiBlame its been there since at least 2023... @DTorsani-WMF @Volker E. (WMF) Waddie96 (talk) 01:15, 5 March 2025 (UTC)Reply

@Waddie96 As long as it takes. Past experiences show that deprecating old technology takes VERY long. For context, we started deprecating jQueryUI over 8 years ago, and it is still present in some areas of our production code, because rewriting code that already works is very expensive. —TheDJ (Not WMF) (talkcontribs) 12:22, 5 March 2025 (UTC)Reply
@TheDJ I see, thanks so much. Waddie96 (talk) 13:11, 5 March 2025 (UTC)Reply

Is it safe to upgrade to the latest version?

[edit]

If you're on, say, MW 1.39, would be it be safe to upgrade to the current stable version of Codex, or does that potentially break things? Rand(1,2022) (talk) 10:50, 12 March 2025 (UTC)Reply

@Rand(1,2022) Compatibility is not guaranteed. It might work, it might not and each to varying degrees. —TheDJ (Not WMF) (talkcontribs) 14:06, 12 March 2025 (UTC)Reply
Alright, thanks! - I had my suspicions but it's good to have them confirmed. Rand(1,2022) (talk) 15:37, 12 March 2025 (UTC)Reply

Create Template:Codex icon to output a Codex icon in wikitext

[edit]

Can someone help me create {{Codex icon }}.

Purpose: Easy template call to insert Codex icons within wikitext.

Parameters: (per wmdoc:codex/latest/components/demos/icon.html)

  • icon= e.g. cdxIconGlobe
  • size= e.g. medium, small, and x-small
  • color= e.g. base , subtle, and placeholder etc.
  • direction= e.g. ltr, rtl

Similar to {{en:OOUI icon}}.

Thanks in advance. Waddie96 (talk) 07:29, 5 August 2025 (UTC)Reply

@Waddie96: That template only works because someone uploaded a bunch of OOUI icons to Commons. See https://en.wikipedia.org/wiki/Template:OOUI_icon/link — someone would need to do the same for Codex icons, and agree to keep them updated, and then build an equivalent template here/there/wherever else it's wanted. Is this something you want to take on? Jdforrester (WMF) (talk) 07:31, 5 August 2025 (UTC)Reply
I thought the API:CodexIcons, or in Template namespace it would be possible with a Vue.js? Sorry I don't know anything about Vue.js etc. Waddie96 (talk) 07:33, 5 August 2025 (UTC)Reply
Because uploading 250 icons and keeping them updated based on Gerrit changelog, is what I'm trying to avoid. Waddie96 (talk) 07:34, 5 August 2025 (UTC)Reply
@Jdforrester (WMF) Waddie96 (talk) 07:44, 5 August 2025 (UTC)Reply
@Waddie96: Indeed, the OOUI icons have this problem too; a bunch of them on Commons are out of date, or missing. Jdforrester (WMF) (talk) 07:46, 5 August 2025 (UTC)Reply
@Jdforrester (WMF): Yes, hence it would be great if a template could call and generate them.
  • What about § CSS-only icons that Import Codex design tokens and the CSS icon mixin. Then, apply the mixin to an empty <span> element.?
  • Or use the Codex icons in a module Codex § Using Codex icons: ResourceLoader provides a way for modules to embed the icons they need, similar to the code-splitting approach described above.? So a module with:
::::{
::::    "name": "icons.json",
::::    "callback": "MediaWiki\\ResourceLoader\\CodexModule::getIcons",
::::    "callbackParam": [
::::        // List the icons your module needs here, e.g.:
::::        "cdxIconArrowNext",
::::        "cdxIconBold",
::::        "cdxIconTrash"
::::    ]
::::}
And then you can call the module to send a CSS-only component or SVG through to the template? Or am I missing something.
Thanks. Waddie96 (talk) 09:17, 5 August 2025 (UTC)Reply
@Waddie96: If you're talking about doing it like this, it can't be done on-wiki. Adding support for using Codex icons from wikitext is a long-term engineering commitment. Did you file a Phabricator task to request this, for the team to evaluate? Jdforrester (WMF) (talk) 09:20, 5 August 2025 (UTC)Reply
@Jdforrester (WMF) I'll do it. So for now only to upload files manually? I could request batch upload, but I may as well get used to Batch uploading myself. Waddie96 (talk) 09:22, 5 August 2025 (UTC)Reply
Yes Task opened. T401186 Waddie96 (talk) 10:25, 5 August 2025 (UTC)Reply

Discussion at Talk:OOUI#Efforts lately to mark OOUI as discouraged seem premature

[edit]

 You are invited to join the discussion at Talk:OOUI#Efforts lately to mark OOUI as discouraged seem premature. –Novem Linguae (talk) 02:34, 24 August 2025 (UTC)Reply