SublimeText / AFileIcon

Sublime Text File-Specific Icons for Improved Visual Grepping
MIT License
251 stars 41 forks source link

[Question] Same icon, different colour #66

Closed mataha closed 1 year ago

mataha commented 1 year ago

Is it possible to provide a different colour for an alias of an icon?

Context: I want to submit a PR that will add an icon for source.Kotlin.gradle scope, but I'd like it to have both the colour of file_type_kotlin and the icon of file_type_gradle to match the behaviour of other editors, e.g. IntelliJ IDEA. Is there a clean way of doing so without declaring a new filetype?

Specifically I'd like to avoid this:

  "file_type_gradle_kotlin": {
    "aliases": [
      {
        "base": "source.Kotlin",
        "extensions": [
          "gradle.kts"
        ],
        "name": "Kotlin (Gradle)",
        "scope": "source.Kotlin.gradle"
      }
    ],
    "color": "blue"
  }

As both Gradle and Kotlin are covered already.

deathaxe commented 1 year ago

Adding another icon type is the only solution as icons are tinted at compile time (svg->png).

Some notes/suggestions:

  1. scope names should be lower case (source.kotlin.gradle).
  2. file type name and scope name parts should be in same order. The oder depends on whether kotlin is interpreted as a dialect/special case of gradle or vise versa.

variant 1 : Interpret Gradle as special case of Kotlin

  "file_type_kotlin_gradle": {
    "aliases": [
      {
        "base": "source.kotlin",
        "extensions": [
          "gradle.kts"
        ],
        "name": "Kotlin (Gradle)",
        "scope": "source.kotlin.gradle"
      }
    ],
    "color": "blue"
  }

variant 2 : Interpret Kotlin as special case of Gradle.

  "file_type_gradle_kotlin": {
    "aliases": [
      {
        "base": "source.kotlin",
        "extensions": [
          "gradle.kts"
        ],
        "name": "Gradle (Kotlin)",
        "scope": "source.gradle.kotlin"
      }
    ],
    "color": "blue"
  }

I'd probably go with variant 1 to keep source.kotlin scope intact.

mataha commented 1 year ago

Variant 1 looks better indeed and is in line with Gradle Groovy scripts (source.groovy.gradle).

Some notes/suggestions:

  1. scope names should be lower case (source.kotlin.gradle).
  2. file type name and scope name parts should be in same order. The oder depends on whether kotlin is interpreted as a dialect/special case of gradle or vise versa.
  1. Kotlin is capitalized everywhere in the code, should I correct that in my PR?
  2. Got it, file_type_kotlin_gradle it is then.
deathaxe commented 1 year ago

As the original Kotlin syntax uses capital K, you should probably better keep going with it. Otherwise we might run into casing issues.