LogoObsidian

Utility

Utility methods and extra library features.


Custom Cursor

custom cursor

Enable the custom cursor to render the Obsidian-styled pointer at your mouse position -- handy for experiences that hide or replace Roblox's default cursor.

Library.ShowCustomCursor = true

These functions allow you to set your own image instead of the default custom cursor.

Library:ChangeCursorIcon(ImageId: string)

-- If you need to change the cursor icon size:
Library:ChangeCursorIconSize(Size: UDim2)

-- To reset it back, use this function:
Library:ResetCursorIcon()

Icons

Icons originate from the lucide icon pack. You can change the icon library so long as you call it before creating any UI elements and it follows the expected return data.

local Library = require(game:GetService("ReplicatedStorage"):WaitForChild("Obsidian"))
local Icons = require(game:GetService("ReplicatedStorage"):WaitForChild("Lucide"))

-- Set Library Icon Module
Library:SetIconModule(Icons)

The direct lucide module can be found here. (Our automation updates the icon spritesheet each month)

Custom Icon Registry

If you'd like to make your own custom Icon Module, make sure it follows these types:

type Icon = {
    Url: string,
    Id: number,
    IconName: string,
    ImageRectOffset: Vector2,
    ImageRectSize: Vector2,
}

type IconModule = {
    Icons: { string },
    GetAsset: (Name: string) -> Icon?,
}

local Icons: IconModule = {
    Icons: {}
}

function Icons.GetAsset(Name: string)
    return nil
end

return Icons

Obsidian is dependent on a few icons to be able to be displayed properly. Please make sure you have icons named:

  • check (Toggles)
  • chevron-up (Dropdowns)
  • move-diagonal-2 (Window Resizing Icon bottom right of the window)
  • key (Key System Tab Icon)
  • search (Searchbar)
  • move (Window movement Icon top right of the window)

Custom Asset Icons

If you'd like to use custom hosted images (like those on Github) with a Roblox Asset ID as a fallback, you can use the built-in ImageManager:

local ImageManager = Library.ImageManager

ImageManager requires the FileSystem and getcustomasset functions to properly download the images. If neither is available, it falls back to the provided Roblox Asset ID. If the saved image won't load properly, it will not fallback to the provided Roblox Asset ID.

AddAsset

Adds a custom asset to the ImageManager

ImageManager.AddAsset("mspaint_logo", 95816097006870, "https://www.mspaint.cc/icon.png")
Arg IdxArgument DescriptionTypeDefault
1Asset Namestringnil
2Roblox Asset IDnumbernil
3Asset URLstringnil
4Force Redownloadboolean?nil

GetAsset

Retrieves the asset ID for the provided asset

local AssetID = ImageManager.GetAsset("mspaint_logo")
Arg IdxArgument DescriptionTypeDefault
1Asset Namestringnil

DownloadAsset

Downloads the asset image to the workspace folder

This runs automatically in AddAsset, so you don't need to call it separately (unless you want to redownload the asset image)

ImageManager.DownloadAsset("mspaint_logo")
Arg IdxArgument DescriptionTypeDefault
1Asset Namestringnil
2Force Redownloadboolean?nil

In Obsidian, there is a helper field that you can set that allows you to easily bind a Keybind to toggle the main window.

MenuGroup:AddLabel("Menu bind"):AddKeyPicker("MenuKeybind", {
    Default = "RightShift",
    NoUI = true,
    Text = "Menu keybind"
})

Library.ToggleKeybind = Options.MenuKeybind 

Lifecycle

OnUnload

Registers a callback that fires when the library is unloaded via Library:Unload().

Library:OnUnload(function()
    print("Library was unloaded!")
end)
Arg IdxArgument DescriptionTypeDefault
1Callback to fire on unloadfunctionnil

Unload

Disconnects all signals registered with GiveSignal, fires all OnUnload callbacks, destroys tooltips and the ScreenGui, and sets Library.Unloaded = true.

Library:Unload()

GiveSignal

Registers an RBXScriptConnection so it is automatically disconnected when Library:Unload() is called.

Library:GiveSignal(RunService.RenderStepped:Connect(function()
    -- your code
end))
Arg IdxArgument DescriptionTypeDefault
1Connection to trackRBXScriptConnectionnil

Toggle

Toggles the main window visibility. This is a convenience wrapper around Window:Toggle().

Library:Toggle()
Arg IdxArgument DescriptionTypeDefault
1Force a specific stateboolean?nil

Theme & Registry

SetFont

Changes the font used across the entire library.

Library:SetFont(Enum.Font.GothamMedium)
-- or
Library:SetFont(Font.fromEnum(Enum.Font.GothamMedium))
Arg IdxArgument DescriptionTypeDefault
1The font to applyFont | Enum.Fontnil

SetNotifySide

Changes which side of the screen notifications appear on.

Library:SetNotifySide("Left")
Arg IdxArgument DescriptionTypeDefault
1Side to show notifications"Left" | "Right""Right"

SetDPIScale

Sets the DPI scale for the entire library. The value is treated as a percentage (100 = normal).

Library:SetDPIScale(125) -- 125% scale
Arg IdxArgument DescriptionTypeDefault
1DPI scale percentagenumber100

AddToRegistry

Registers a GuiObject so its properties are automatically updated when the theme changes.

Library:AddToRegistry(MyFrame, {
    BackgroundColor3 = "MainColor",
})
Arg IdxArgument DescriptionTypeDefault
1The GUI instance to trackGuiObjectnil
2Property-to-scheme-key mappingtablenil

RemoveFromRegistry

Removes a GuiObject from the theme registry.

Library:RemoveFromRegistry(MyFrame)
Arg IdxArgument DescriptionTypeDefault
1The GUI instance to untrackGuiObjectnil

UpdateColorsUsingRegistry

Re-applies the current scheme to every registered instance. Called automatically when the theme changes.

Library:UpdateColorsUsingRegistry()

Color Helpers

GetBetterColor

Adjusts a color's value (brightness) by the given amount.

local adjusted = Library:GetBetterColor(Color3.new(1, 0, 0), 0.1)
Arg IdxArgument DescriptionTypeDefault
1Base colorColor3nil
2Value adjustment amountnumbernil

GetLighterColor

Returns a slightly lighter version of the given color.

local lighter = Library:GetLighterColor(Library.Scheme.MainColor)
Arg IdxArgument DescriptionTypeDefault
1Base colorColor3nil

GetDarkerColor

Returns a slightly darker version of the given color.

local darker = Library:GetDarkerColor(Library.Scheme.MainColor)
Arg IdxArgument DescriptionTypeDefault
1Base colorColor3nil

Misc Helpers

SafeCallback

Wraps a function call in error handling. If the call errors and Library.NotifyOnError is true, a notification is shown.

Library:SafeCallback(myFunction, arg1, arg2)
Arg IdxArgument DescriptionTypeDefault
1Function to callfunctionnil
...Arguments to passanynil

GetTextBounds

Calculates the pixel dimensions of a text string with the given font and size.

local width, height = Library:GetTextBounds("Hello", Library.Scheme.Font, 14, 200)
Arg IdxArgument DescriptionTypeDefault
1Text to measurestringnil
2Font to useFontnil
3Text sizenumbernil
4Max width constraintnumber?nil

Properties

These are notable properties on the Library object that you can read or set:

Prop

Type

On this page