Skip to content

Commit db2c477

Browse files
committed
Add monochrome option to TextMeshProUGUI
1 parent 0b44abc commit db2c477

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

BeatSaberMarkupLanguage/BeatSaberUI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ private static Texture2D CopyTexture(Texture2D texture, string newName)
692692

693693
// 1 × 1 texture causes TMP to reinitialize the texture
694694
Texture2D newTexture = new(shouldCopy ? texture.width : 1, shouldCopy ? texture.height : 1, texture.graphicsFormat, texture.mipmapCount, TextureCreationFlags.DontInitializePixels | TextureCreationFlags.DontUploadUponCreate)
695-
{
695+
{
696696
name = newName,
697697
};
698698

BeatSaberMarkupLanguage/TypeHandlers/TextMeshProUGUIHandler.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class TextMeshProUGUIHandler : TypeHandler<TextMeshProUGUI>
3030
{ "lineSpacing", new[] { "line-spacing" } },
3131
{ "lineSpacingAdjustment", new[] { "line-spacing-adjustment" } },
3232
{ "paragraphSpacing", new[] { "paragraph-spacing" } },
33+
{ "monochrome", new[] { "monochrome" } },
3334
};
3435

3536
public override Dictionary<string, Action<TextMeshProUGUI, string>> Setters => new()
@@ -55,6 +56,7 @@ public class TextMeshProUGUIHandler : TypeHandler<TextMeshProUGUI>
5556
{ "lineSpacing", new Action<TextMeshProUGUI, string>((textMesh, value) => textMesh.lineSpacing = Parse.Float(value)) },
5657
{ "lineSpacingAdjustment", new Action<TextMeshProUGUI, string>((textMesh, value) => textMesh.lineSpacingAdjustment = Parse.Float(value)) },
5758
{ "paragraphSpacing", new Action<TextMeshProUGUI, string>((textMesh, value) => textMesh.paragraphSpacing = Parse.Float(value)) },
59+
{ "monochrome", new Action<TextMeshProUGUI, string>((textMesh, value) => textMesh.font = Parse.Bool(value) ? BeatSaberUI.MonochromeTextFont : BeatSaberUI.MainTextFont) },
5860
};
5961

6062
private static FontStyles SetStyle(FontStyles existing, FontStyles modifyStyle, string flag)

BeatSaberMarkupLanguage/Views/gameplay-setup.bsml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<page-button direction='Left' pref-width='4' pref-height='4' tags='left-button'/>
1313
<tab-selector tab-tag='mod-tab' child-expand-width='true' child-control-width='true' page-count='3' left-button-tag='left-button' right-button-tag='right-button' />
1414
<page-button direction='Right' pref-width='4' pref-height='4' tags='right-button'/>
15-
<clickable-text text='👁' align='Midline' hover-hint-key='BSML_GAMEPLAY_SETUP_EDIT_VISIBLE_TABS_HINT' on-click='show-modal' />
15+
<clickable-text text='👁' align='Midline' hover-hint-key='BSML_GAMEPLAY_SETUP_EDIT_VISIBLE_TABS_HINT' on-click='show-modal' monochrome='true' />
1616
</horizontal>
1717
<macro.for-each items='mod-menus' pass-back-tags='true'>
1818
<tab tags='mod-tab' tab-name='~tab-name' id='root-tab' />

0 commit comments

Comments
 (0)