some infos about os x

Mac OSX specific forum
delikanli_19_82
User
User
Posts: 38
Joined: Tue Jun 21, 2011 6:11 pm

some infos about os x

Post by delikanli_19_82 »

hello guys,

i am also new to mac, so i have some questions and hope, that someone can help me:

- where is the os x theme data storaged on the disc? like "C:->windows->resources"...

- how can i find out the system colors by code? ( text color, selected text color, selected background color and so on. )

- where is the fonts-directory like under windows "c:->windows->fonts"?

- how can i find the current environment language?

- how can i change the icon of a directory or file by code?

kind regards

kurt
User avatar
Shardik
Addict
Addict
Posts: 2058
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: some infos about os x

Post by Shardik »

delikanli_19_82 wrote:- how can i find the current environment language?
This question was already posted in the German forum and two different solutions were presented.
delikanli_19_82 wrote:- how can i find out the system colors by code? ( text color, selected text color, selected background color and so on. )

Code: Select all

ImportC ""
  CopyThemeIdentifier(*Identifier)
  CFRelease(CFTypeRef.L)
  CFStringGetCString(CFStringRef.L, *Buffer, BufferSize, Encoding.L)
  GetThemeBrushAsColor(BrushColor.L, ColorDepth.W, IsColorDevice.L, *Color)
  GetThemeTextColor(TextColor.L, ColorDepth.W, IsColorDevice.L, *Color)
  SetDataBrowserHasScrollBars(ControlRef.L, HasHorizontalScrollBar.L, HasVerticalScrollBar.L)
EndImport

Structure RGBColor
  Red.U
  Green.U
  Blue.U
EndStructure

Structure ColorEntry
  Name.S
  Value.L
EndStructure

Define i.L
Define Identifier.S
Define IdentifierRef.L
Define Value.L

NewList BrushColor.ColorEntry()
NewList TextColor.ColorEntry()

; ----- Read brush colors

Value = -1

For i = 1 To 4
  AddElement(BrushColor())
  Read.S BrushColor()\Name
  BrushColor()\Value = Value
  Value - 1
Next i

For i = 1 To 55
  AddElement(BrushColor())
  Read.S BrushColor()\Name
  BrushColor()\Value = i
Next i

; ----- Read text colors

Value = -1

For i = 1 To 2
  AddElement(TextColor())
  Read.S TextColor()\Name
  TextColor()\Value = Value
  Value - 1
Next i

For i = 1 To 48
  AddElement(TextColor())
  Read.S TextColor()\Name
  TextColor()\Value = i
Next i

SortStructuredList(BrushColor(), #PB_Sort_Ascending, OffsetOf(ColorEntry\Name), #PB_Sort_String)
SortStructuredList(TextColor(), #PB_Sort_Ascending, OffsetOf(ColorEntry\Name), #PB_Sort_String)

OpenWindow(0, 200, 100, 424, 590, "System background and text colors")

ListIconGadget(0, 10, 30, WindowWidth(0) - 20, 270, "Background color", 220)
AddGadgetColumn(0, 1, "Value", 53)
AddGadgetColumn(0, 2, "RGB-Value", 85)
SetDataBrowserHasScrollBars(GadgetID(0), #False, #True)

ListIconGadget(1, 10, 310, WindowWidth(0) - 20, 270, "Text color", 220)
AddGadgetColumn(1, 1, "Value", 53)
AddGadgetColumn(1, 2, "RGB-Value", 85)
SetDataBrowserHasScrollBars(GadgetID(1), #False, #True)

; ----- Get and display theme name

If CopyThemeIdentifier(@IdentifierRef) = 0
  Identifier = Space(100)
  CFStringGetCString(IdentifierRef, @Identifier, Len(Identifier), 0)
  CFRelease(IdentifierRef)
EndIf

TextGadget(2, 10, 10, WindowWidth(0) - 20, 20, "Theme name: " + Identifier)

; ----- Get and display brush element names and colors

Index = 0

ForEach BrushColor()
  If GetThemeBrushAsColor(BrushColor()\Value, 24, #True, @Color.RGBColor) = 0
    CreateImage(Index, 16, 16, 24)
    
    If StartDrawing(ImageOutput(Index))
      Box(0, 0, 15, 15, RGB(Color\Red & $FF, Color\Green & $FF, Color\Blue & $FF))
      StopDrawing()
    EndIf

  EndIf

  AddGadgetItem(0, -1, BrushColor()\Name + #LF$ + Str(BrushColor()\Value) + #LF$ + "$" + RSet(Hex(Color\Blue & $FF), 2, "0") + RSet(Hex(Color\Green & $FF), 2, "0") + RSet(Hex(Color\Red & $FF), 2, "0"), ImageID(Index))
  Index + 1
Next

; ----- Get and display text element names and colors

ForEach TextColor()
  If GetThemeTextColor(TextColor()\Value, 24, #True, @Color.RGBColor) = 0
    CreateImage(Index, 16, 16, 24)
    
    If StartDrawing(ImageOutput(Index))
      Box(0, 0, 15, 15, RGB(Color\Red & $FF, Color\Green & $FF, Color\Blue & $FF))
      StopDrawing()
    EndIf

  EndIf

  AddGadgetItem(1, -1, TextColor()\Name + #LF$ + Str(TextColor()\Value) + #LF$ + "$" + RSet(Hex(Color\Blue & $FF), 2, "0") + RSet(Hex(Color\Green & $FF), 2, "0") + RSet(Hex(Color\Red & $FF), 2, "0"), ImageID(Index))
  Index + 1
Next

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow

End

DataSection
  ; ----- Theme Brush Colors

  ; Values -1..-4

  Data.S "Black"
  Data.S "White"
  Data.S "PrimaryHighlightColor"
  Data.S "SecondaryHighlightColor"

  ; Values 1..55

  Data.S "DialogBackgroundActive"
  Data.S "DialogBackgroundInactive"
  Data.S "AlertBackgroundActive"
  Data.S "AlertBackgroundInactive"
  Data.S "ModelessDialogBackgroundActive"
  Data.S "ModelessDialogBackgroundInactive"
  Data.S "UtilityWindowBackgroundActive"
  Data.S "UtilityWindowBackgroundInactive"
  Data.S "ListViewSortColumnBackground"
  Data.S "ListViewBackground"
  Data.S "IconLabelBackground"
  Data.S "ListViewSeparator"
  Data.S "ChasingArrows"
  Data.S "DragHilite"
  Data.S "DocumentWindowBackground"
  Data.S "FinderWindowBackground"
  Data.S "ScrollBarDelimiterActive"
  Data.S "ScrollBarDelimiterInactive"
  Data.S "FocusHighlight"
  Data.S "PopupArrowActive"
  Data.S "PopupArrowPressed"
  Data.S "PopupArrowInactive"
  Data.S "AppleGuideCoachmark"
  Data.S "IconLabelBackgroundSelected"
  Data.S "StaticAreaFill"
  Data.S "ActiveAreaFill"
  Data.S "ButtonFrameActive"
  Data.S "ButtonFrameInactive"
  Data.S "ButtonFaceActive"
  Data.S "ButtonFaceInactive"
  Data.S "ButtonFacePressed"
  Data.S "ButtonActiveDarkShadow"
  Data.S "ButtonActiveDarkHighlight"
  Data.S "ButtonActiveLightShadow"
  Data.S "ButtonActiveLightHighlight"
  Data.S "ButtonInactiveDarkShadow"
  Data.S "ButtonInactiveDarkHighlight"
  Data.S "ButtonInactiveLightShadow"
  Data.S "ButtonInactiveLightHighlight"
  Data.S "ButtonPressedDarkShadow"
  Data.S "ButtonPressedDarkHighlight"
  Data.S "ButtonPressedLightShadow"
  Data.S "ButtonPressedLightHighlight"
  Data.S "BevelActiveLight"
  Data.S "BevelActiveDark"
  Data.S "BevelInactiveLight"
  Data.S "BevelInactiveDark"
  Data.S "NotificationWindowBackground"
  Data.S "MovableModalBackground"
  Data.S "SheetBackgroundOpaque"
  Data.S "DrawerBackground"
  Data.S "ToolbarBackground"
  Data.S "SheetBackgroundTransparent"
  Data.S "MenuBackground"
  Data.S "MenuBackgroundSelected"

  ; ----- Theme Text Colors

  ; Values -1..-2

  Data.S "Black"
  Data.S "White"

  ; Values 1..48

  Data.S "DialogActive"
  Data.S "DialogInactive"
  Data.S "AlertActive"
  Data.S "AlertInactive"
  Data.S "ModelessDialogActive"
  Data.S "ModelessDialogInactive"
  Data.S "WindowHeaderActive"
  Data.S "WindowHeaderInactive"
  Data.S "PlacardActive"
  Data.S "PlacardInactive"
  Data.S "PlacardPressed"
  Data.S "PushButtonActive"
  Data.S "PushButtonInactive"
  Data.S "PushButtonPressed"
  Data.S "BevelButtonActive"
  Data.S "BevelButtonInactive"
  Data.S "BevelButtonPressed"
  Data.S "PopupButtonActive"
  Data.S "PopupButtonInactive"
  Data.S "PopupButtonPressed"
  Data.S "IconLabel"
  Data.S "ListView"
  Data.S "DocumentWindowTitleActive"
  Data.S "DocumentWindowTitleInactive"
  Data.S "MovableModalWindowTitleActive"
  Data.S "MovableModalWindowTitleInactive"
  Data.S "UtilityWindowTitleActive"
  Data.S "UtilityWindowTitleInactive"
  Data.S "PopupWindowTitleActive"
  Data.S "PopupWindowTitleInactive"
  Data.S "RootMenuActive"
  Data.S "RootMenuSelected"
  Data.S "RootMenuDisabled"
  Data.S "MenuItemActive"
  Data.S "MenuItemSelected"
  Data.S "MenuItemDisabled"
  Data.S "PopupLabelActive"
  Data.S "PopupLabelInactive"
  Data.S "TabFrontActive"
  Data.S "TabNonFrontActive"
  Data.S "TabNonFrontPressed"
  Data.S "TabFrontInactive"
  Data.S "TabNonFrontInactive"
  Data.S "IconLabelSelected "
  Data.S "BevelButtonStickyActive"
  Data.S "BevelButtonStickyInactive"
  Data.S "Notification"
  Data.S "SystemDetail"
EndDataSection
WilliamL
Addict
Addict
Posts: 1252
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: some infos about os x

Post by WilliamL »

Thanks Shardik,

I wondered what these colors were too. The code makes a nice display of the info too with the use of the ListIconGadget.

You know someone is going to ask what the default system font is next. 8)
MacBook Pro-M1 (2021), Sequoia 15.4, PB 6.20
Post Reply