Home Installation Release notes Language Reference Support Downloads Tutorials FutureBasic 5 Links

Asset Catalog - Color

1. Launch Xcode and choose File > New > File… (⌘N)


 

2. In the template sheet...
a) click "macOS"
b) scroll down to the 'Resource' section and choose "Asset Catalog"
c) click the "Next" button


 

3. Click the "Create" button and save the file as "Assets" to your FB app folder


 

4. An empty asset catalog will be displayed. Click the '+' button at the bottom of the outline view and choose New Color Set from the menu


 

5. Give the color a name


 

6. Show the Attributes Inspector (View/Inspectors/Attributes ⌥⌘4)


 

7. In the Attributes Inspector (right hand column), change Devices from Universal to Mac


 

8. Click on the 'Any Appearance' color well and set its color in the attributes inspector


 

9. Click on the 'Dark' color well and set its color in the attributes inspector


 

10. In FutureBasic, create a new file and paste the following code

include resources "Assets.xcassets"

void local fn BuildWindow
window 1, @"Asset Catalog - Color", (0,0,480,270)

textlabel 1, @"Text", (211,117,58,35)
ControlSetFont( 1, fn FontSystemFontOfSize( 30 ) )
TextFieldSetTextColor( 1, fn ColorNamed( @"MyColor" ) )
end fn

fn BuildWindow

HandleEvents
 

11. Save the FB file to the same folder as the asset catalog and run it