4
$\begingroup$

The FE stores a bunch of little nine-patch images in the layout that govern the appearance of much of Mathematica. These things are incredibly useful to have as they may be used to give a clean appearance to custom Panel and Button objects and things.

How can I get these?

$\endgroup$
5
$\begingroup$

Here's a little function that gets the FrontEnd`FileName stuff:

bmpPath =
  ToFileName /@
   DeleteCases[
    CurrentValue[$FrontEndSession, {PrivatePaths, "Bitmaps"}],
    ParentList
    ];(* use this if you want to look at _all_ of the bitmaps *)

bmpPath = 
  FileNameJoin@{$InstallationDirectory, "SystemFiles", "FrontEnd", 
    "SystemResources", "Bitmaps"};

feBMPs =
  AssociationMap[
   With[{key = #[[1]], groups = #[[2]]},
     key ->
      AssociationMap[
       #[[1]] ->
         With[{p = #[[1]]}, Association@

           Map[StringSplit[FileNameTake[#], "."][[1]] -> 
              FrontEnd`FileName[
               Evaluate@If[key === "Bitmaps", {p}, {key, p}], 
               Evaluate@FileNameTake[#]] &, #[[2]]]
          ] &,
       groups
       ]
     ] &,
   Map[
    GroupBy[#, FileNameTake[#, {-2}] &] &,
    GroupBy[
     FileNames["*.9.png", bmpPath, 
      5],
     FileNameTake[#, {-3}] &
     ]
    ]
   ];

Then we can analyze some of this stuff:

feBMPs // Keys

{"Dialogs", "Choosers", "Popups", "Ribbons", "Bitmaps", "Toolbars", "Typeset"}

Keys /@ feBMPs

<|"Dialogs" -> {"CloudLogin", "Activation", "CloudDialogs", 
   "DeployCDF", "WelcomeScreen"}, "Choosers" -> {"Color"}, 
 "Popups" -> {"CodeCompletion"}, "Ribbons" -> {"Common", "Image"}, 
 "Bitmaps" -> {"Toolbars"}, "Toolbars" -> {"Player"}, 
 "Typeset" -> {"Audio", "FormObject", "InputField", "PrintTemporary", 
   "ProgressIndicator", "Quantity", "SummaryBox", "TableView"}|>

And we can look at some elements in the thing explicitly. Here are all the bitmaps used in the little autocompletion popup:

Map[
  RawBoxes@DynamicBox[FEPrivate`ImportImage[#]] &,
  feBMPs["Popups", "CodeCompletion"]
  ] // Dataset

enter image description here

$\endgroup$

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.