Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

setting icon

is there a way from the UI to set a project's icon? thanks!


  • dave1707dave1707 Mod
    Posts: 8,739

    What do you mean by the UI. How exactly do you want to try and set it. You can set an Icon from the camera icon (lower left) when the code is running, or you can save an image named Icon in the project folder.

  • Posts: 806

    ah, didn't know the camera trick. nearly good. one could imagine near the rename, a pic finder or the like. anyway thanks!

  • Posts: 806

    Trying to set icon on iPad Pro12.9 3g, says asset.Icon doesn't exist:

  • Posts: 806

    This is truly weird. Also on one iPad i can look into Codea projects in Files, and on the other i cannot. :)

  • Posts: 1,917

    @RonJeffries - it has changed over the years - the Codea project storage. I think it used to be stored as project.codea where ‘project’ is your project name. I think that you don’t need the file type now, ie drop the .codea. The project is just a folder which holds a Info.plist containing the files involved, the tabs as separate .lua files and icons. There used to be two icons - Icon.png and Icon@2x.png for the resolutions available. Note the icon case is important. You can see this if you open a project outside the iPad (PC) or if you take an exported/zipped project and unzip it.

    It’s easier to just use the screen camera capture with the save icon (camera) option. You may need to address the icon in the correct case - could be something like ‘asset.documents.Icon‘. @Simeon will be able to tell you current practice.

    Another point - you can set up a folder with assets in which is grouped with the other general assets in the root , ie outside documents folder - I do it by creating a folder externally containing the plist and icons e.g. for my Beermat Puzzle I have one named BMP.assets and it holds all the images I used. Ironically you have to address it as follows:

    icn = asset.documents.BMP.Icon

    Then you can load the project icon up directly.

  • Posts: 806

    Interesting. I think I'd have to see a picture of the structure you're describing and the steps you use to set it up. I'm not clear on some of the ideas, I guess.

  • SimeonSimeon Admin Mod
    Posts: 5,434

    Here's a project that changes its icon to a randomly coloured circle every time it is run:

    -- Random Icon
    function setup() 
        local icon = image(512,512)
        rect(0, 0, 512, 512)
        fill(math.random(0, 255), math.random(0, 255), math.random(0, 255))
        saveImage(asset .. "Icon.png", icon)
    function draw()
        background(40, 40, 50)
  • Posts: 806

    Yes. My issue was that one can't say asset.Icon unless the Icon already exists, and I had somehow managed to do it right in the past, on one project, so all my tests worked fine ... on that project. :)

Sign In or Register to comment.