Merge pull request #2596 from MartinFournier/feature/ns-ui-styles

Add ns.ui.[getStyles, setStyles, resetStyles]
This commit is contained in:
hydroflame
2022-01-12 19:18:54 -05:00
committed by GitHub
10 changed files with 174 additions and 11 deletions

View File

@@ -1,3 +1,5 @@
import React from 'react';
/**
* @public
*/
@@ -119,7 +121,7 @@ export interface IPort {
/** add data to port if not full.
* @returns true if added and false if full and not added */
tryWrite: (value: any) => boolean;
/** reads and removes first element from port
/** reads and removes first element from port
* if no data in port returns "NULL PORT DATA"
*/
read: () => any;
@@ -3880,6 +3882,37 @@ interface UserInterface {
* RAM cost: cost: 0 GB
*/
resetTheme(): void;
/**
* Get the current styles
* @remarks
* RAM cost: cost: 0 GB
*
* @returns An object containing the player's styles
*/
getStyles(): IStyleSettings;
/**
* Sets the current styles
* @remarks
* RAM cost: cost: 0 GB
* @example
* Usage example (NS2)
* ```ts
* const styles = ns.ui.getStyles();
* styles.fontFamily = 'Comic Sans Ms';
* ns.ui.setStyles(styles);
* ```
*/
setStyles(newStyles: IStyleSettings): void;
/**
* Resets the player's styles to the default values
* @remarks
* RAM cost: cost: 0 GB
*/
resetStyles(): void;
}
/**
@@ -6354,3 +6387,12 @@ interface UserInterfaceTheme {
backgroundsecondary: string;
button: string;
}
/**
* Interface Styles
* @internal
*/
interface IStyleSettings {
fontFamily: React.CSSProperties["fontFamily"];
lineHeight: React.CSSProperties["lineHeight"];
}