Type Function Library display.* Return value various Revision Release 2022.3683 Keywords defaults, get default, color, graphics, vector objects See also display.setDefault()
Get default display values including default colors for display objects, anchor point defaults, texture wrapping settings, etc.
display.getDefault( key )
String. Specifies the key to get the default value for.
These keys indicate default anchor values and anchor bounds for all display objects.
"anchorX"
— The default anchor alignment along the x direction. Values range between 0
and 1
.
"anchorY"
— The default anchor alignment along the y direction. Values range between 0
and 1
.
A color key indicates which default color value is set.
"background"
— The default color for that the screen is cleared with. Returns multiple values (see example below).
"fillColor"
— The default fill color for vector objects like display.newRect(). Returns multiple values (see example below).
"strokeColor"
— The default stroke color for vector objects like display.newRect(). Returns multiple values (see example below).
"lineColor"
— The default color for line objects like display.newLine(). Returns multiple values (see example below).
"isNativeTextBoxFontSizeScaled"
— The default Boolean value to be assigned to a native text box's object.isFontSizeScaled property when created via the native.newTextBox() function. This is true
by default.
"isNativeTextFieldFontSizeScaled"
— The default Boolean value to be assigned to a native text field's object.isFontSizeScaled property when created via the native.newTextField() function. This is true
by default.
"isExternalTextureRetina"
— The default Boolean value to be assigned as a external texture's sampling behavior whenever a new one is created, say by a plugin. This is true
by default.
"isImageSheetFrameTrimCorrected"
— The default Boolean value to be assigned as a new sprite's frame trim correction behavior whenever a sprite is loaded by Solar2D. This is false
by default.
"magTextureFilter"
— The default magnification sampling filter applied whenever an image is loaded. Values include "linear"
or "nearest"
.
"minTextureFilter"
— The default minification sampling filter applied whenever an image is loaded. Values include "linear"
or "nearest"
.
"textureWrapX"
— The texture wrap mode along the x direction. Values include "clampToEdge"
, "repeat"
, or "mirroredRepeat"
.
"textureWrapY"
— The texture wrap mode along the y direction. Values include "clampToEdge"
, "repeat"
, or "mirroredRepeat"
.
-- Fill color default values local defaultR, defaultG, defaultB, defaultA = display.getDefault( "fillColor" ) print( defaultR, defaultG, defaultB, defaultA ) -- Default "anchorX" value local defaultAnchorX = display.getDefault( "anchorX" ) print( defaultAnchorX ) -- Default "anchorY" value local defaultAnchorY = display.getDefault( "anchorY" ) print( defaultAnchorY )