diff --git a/code/__DEFINES/__game.dm b/code/__DEFINES/__game.dm index f84b3d316d3c..d1cc112e23e4 100644 --- a/code/__DEFINES/__game.dm +++ b/code/__DEFINES/__game.dm @@ -556,3 +556,6 @@ #define PERF_TOGGLE_SHUTTLES (1<<3) /// Disables loading Techwebs and additional Z-Levels #define PERF_TOGGLE_TECHWEBS (1<<4) + +/// Maptext styles +#define MAP_STYLESHEET ".maptext { font-family: 'Small Fonts'; font-size: 7px; -dm-text-outline: 1px black; color: white; line-height: 1.1; } .center { text-align: center; } .langchat { font-family: 'Small Fonts'; font-size: 7px; -dm-text-outline: 1px black; } .langchat_small { font-size: 6px; } .langchat_yell { font-weight: bold; font-size: 10px; } .langchat_bolded { font-weight: bold; font-size: 8px; } .langchat_announce { font-weight: bold; font-size: 12px; } .langchat_bolditalicbig {font-weight: bold; font-size: 24px; font-style: italic; } .langchat_italic {font-style: italic; }" diff --git a/code/controllers/subsystem/tgui.dm b/code/controllers/subsystem/tgui.dm index a3ef03f3e397..7df4e7ce9c2b 100644 --- a/code/controllers/subsystem/tgui.dm +++ b/code/controllers/subsystem/tgui.dm @@ -32,6 +32,7 @@ SUBSYSTEM_DEF(tgui) var/polyfill = file2text('tgui/public/tgui-polyfill.min.js') polyfill = "" basehtml = replacetextEx(basehtml, "", polyfill) + basehtml = replacetext(basehtml, "tgui:stylesheet", MAP_STYLESHEET) /datum/controller/subsystem/tgui/Shutdown() close_all_uis() diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index ae16314546d1..890edc5cd927 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -410,6 +410,7 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list( connection_time = world.time winset(src, null, "command=\".configure graphics-hwmode on\"") + winset(src, "map", "style=\"[MAP_STYLESHEET]\"") send_assets() diff --git a/interface/skin.dmf b/interface/skin.dmf index 9b8a870e68e8..cab4ecebe835 100644 --- a/interface/skin.dmf +++ b/interface/skin.dmf @@ -223,7 +223,6 @@ window "mapwindow" font-size = 7 is-default = true saved-params = "zoom;letterbox;zoom-mode" - style = ".maptext { font-family: 'Small Fonts'; font-size: 7px; -dm-text-outline: 1px black; color: white; line-height: 1.1; } .center { text-align: center; } .langchat { font-family: 'Small Fonts'; font-size: 7px; -dm-text-outline: 1px black; } .langchat_small { font-size: 6px; } .langchat_yell { font-weight: bold; font-size: 10px; } .langchat_bolded { font-weight: bold; font-size: 8px; } .langchat_announce { font-weight: bold; font-size: 12px; } .langchat_bolditalicbig {font-weight: bold; font-size: 24px; font-style: italic; } .langchat_italic {font-style: italic; }" elem "status_bar" type = LABEL pos = 0,464 diff --git a/tgui/global.d.ts b/tgui/global.d.ts index 9cb8e37c2e8c..994632e499a3 100644 --- a/tgui/global.d.ts +++ b/tgui/global.d.ts @@ -158,6 +158,11 @@ type ByondType = { * Loads a script into the document. */ loadJs(url: string): void; + + /** + * The ByondCSS stylesheet to load into ByondUI components + */ + styleSheet: string; }; /** diff --git a/tgui/packages/tgui/components/ByondUi.jsx b/tgui/packages/tgui/components/ByondUi.jsx index c119879dd2a7..41304745509b 100644 --- a/tgui/packages/tgui/components/ByondUi.jsx +++ b/tgui/packages/tgui/components/ByondUi.jsx @@ -28,7 +28,8 @@ const createByondUiElement = (elementId) => { render: (params) => { logger.log(`rendering '${id}'`); byondUiStack[index] = id; - Byond.winset(id, params); + + Byond.winset(id, { ...params, style: Byond.styleSheet }); }, unmount: () => { logger.log(`unmounting '${id}'`); diff --git a/tgui/public/tgui.html b/tgui/public/tgui.html index 807abca247f7..9db3acec2ebe 100644 --- a/tgui/public/tgui.html +++ b/tgui/public/tgui.html @@ -40,6 +40,8 @@ // Expose inlined metadata Byond.windowId = parseMetaTag('tgui:windowId'); + Byond.styleSheet = "tgui:stylesheet" + // Backwards compatibility window.__windowId__ = Byond.windowId;