JulianGaibler / atlas

Theme Manger for Figma
6 stars 4 forks source link

Allow to import multiple libraries in one go #5

Closed lukasoppermann closed 2 years ago

lukasoppermann commented 2 years ago

Hey, as you know I love the plugin! ❤️ But I have a little issue I would like to see addressed.

I am building a design system with a light and a dark mode. Since most products will be developed either in light or in dark mode, I will split the libraries into a dark and a light library. This makes it easier to work with the libraries.

I want to use atlas to switch between the two libraries if a user imports both libraries into one file. This works great. The only issue I have is that you need to import both libraries individually into atlas.

I want to make it as easy as possible for my users, as they may already be confused by having to import json into a plugin, so I would like to offer the json as one file to import.

Can you add this capability?

I imagine the json would look like this:

[
  {
    "mapName": "Lib Dark",
    "lastUpdatedISO": "2021-12-02T13:28:54.538Z",
    "themes": [
      {
        "displayName": "Dark",
        "idName": "dark",
        "color": "#3A3A3A",
        "group": "Group"
      }
    ],
    "arrayMap": [
      [
        "background",
        {
          "dark": {
            "id": "S:657e533554ac4dc99bcfcd22162a08f224080944,",
            "key": "657e533554ac4dc99bcfcd22162a08f224080944",
            "type": "PAINT"
          }
        }
      ]
    ]
  },
  {
    "mapName": "Lib Light",
    "lastUpdatedISO": "2021-12-02T13:30:32.875Z",
    "themes": [
      {
        "displayName": "Light",
        "idName": "light",
        "color": "#F1F1F1",
        "group": "Group"
      }
    ],
    "arrayMap": [
      [
        "background",
        {
          "light": {
            "id": "S:32ccb4aa5667537fcd67fb2233426b448e662516,",
            "key": "32ccb4aa5667537fcd67fb2233426b448e662516",
            "type": "PAINT"
          }
        }
      ]
    ]
  }
]
JulianGaibler commented 2 years ago

Looking into it :)

JulianGaibler commented 2 years ago

Hi! It's essentially implemented as you suggested. Square brackets around the maps and then separated by comma :)

I didn't add any UI affordance to re-export maps in this format for now, as I am still investigating if there is a better way to share maps without having to distribute JSON strings to the rest of the team.

lukasoppermann commented 2 years ago

Great.

I didn't add any UI affordance to re-export maps in this format for now, as I am still investigating if there is a better way to share maps without having to distribute JSON strings to the rest of the team.

One think that would be neat is if a user could just paste a url to a json file. This way a file could be hosted on github with all themes and the users could just import it.

Of course if it could somehow be shared via the lib files themselves that would be great. But this is probably not possible.