scratchblocks / scratchblocks

Make pictures of Scratch blocks from text.
http://scratchblocks.github.io/
Other
394 stars 181 forks source link

Nonstandard Categories #528

Open Steve0Greatness opened 3 weeks ago

Steve0Greatness commented 3 weeks ago

Scratch mods, like Turbowarp, provide the ability to add extensions to your project that are not provided by Scratch. These extensions can have their own block colors and icons. I suggest the ability to define the extensions with the scratchblocks.renderMatching function.

Specifically, this would be done using a categories key in the dictionary that comes after the selectors. This itself would be a dictionary that defines the id of the category, or what will be used to make a block be it (like pen is used for it to be pen), the color of the category (similar to how you can have a hex value or preexisting category name after the ::) and the category icon (which would display like how it does on pen).

ego-lay-atman-bay commented 3 weeks ago

The only idea I can think of is by adding

block :: icon(https://image.com)

Other then that, I don't think it would be very practical.

Steve0Greatness commented 3 weeks ago

Actually, allowing it to be defined by the script that is being parsed might not be the best idea (in cases like the Scratch Wiki, users add it, so it'd be an abusable way to show inappropriate stuff). Maybe instead it could be defined in the by scratchblocks.renderMatching. IE, in the passed object have a categories key that allows for each category to have a color and assigned image.

So like

scratchblocks.renderMatching("...", {
  ...
  categories: {
    cat: {
      color: "grey",
      icon: "https://..."
    }
  }
})

Both should probably be optional, and the color should default to the extension color.

ego-lay-atman-bay commented 3 weeks ago

That would actually be a good idea. I think it would also be a good idea to allow the category color to be a default category, so you can have a custom category copy another category color, like the motion category.