Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better generation #3

Open
jbrooksuk opened this issue Sep 17, 2013 · 18 comments
Open

Better generation #3

jbrooksuk opened this issue Sep 17, 2013 · 18 comments
Labels

Comments

@jbrooksuk
Copy link
Owner

I'm currently working on a generator which takes a JSON file and generates a tmTheme file.

My thinking is that we can produce a template for Oblivion, then using a little bit of code we can tinker with the colours and produce variations of the theme that contain the same scopes and features as all of the others.

This script will be going into another repository, I'll add a link once it's done.

@hussani
Copy link
Collaborator

hussani commented Oct 7, 2013

+1

It's very cool.
Currently is very difficult change a collor in theme.
A generator solve this problem.

@jbrooksuk
Copy link
Owner Author

Just need to find some time to work on this and we'll be generating them really quickly.

One of the benefits of doing this is that we can specify the colour palettes in JSON/YAML and instantly have the scheme updated across all variations. This is great if we modify a colour or we add an extra scope.

@hussani
Copy link
Collaborator

hussani commented Oct 7, 2013

What you think about it:

<dict>
    <key>name</key>
    <string>User-defined constant</string>
    <key>scope</key>
    <string>constant.character, constant.other</string>
    <key>settings</key>
    <dict>
        <key>foreground</key>
        <string>#AE81FF</string>
    </dict>
</dict>
<dict>
    <key>name</key>
    <string>Variable</string>
    <key>scope</key>
    <string>variable</string>
    <key>settings</key>
    <dict>
        <key>foreground</key>
        <string>#6290C5</string>
        <key>fontStyle</key>
        <string></string>
    </dict>
</dict>

This block can be write as:

array:
    - name: User-defined constant
      scope: "constant.character, constant.other"
      settings: 
        foreground: "#AE81FF"
    - name: Variable
      scope: variable
      settings:
        foreground: "#6290C5"
        fontStyle: ""

YAML is really good!

We can use named color to a better writing.
I'm really excited with this.

What language do you use?

@jbrooksuk
Copy link
Owner Author

That looks awesome to me!

I'll be writing the generator with Node.js, so JavaScript. Originally I was going to do it in JSON, but YAML looks nicer for this. You can check my empty repository here.

@jbrooksuk
Copy link
Owner Author

I found this which generates PList from JSON. I can change the JSON bit to YAML and have everything running pretty smoothly.

@jbrooksuk
Copy link
Owner Author

@hussani check this out.

@jbrooksuk
Copy link
Owner Author

TTheme is able to use JSON and YAML (untested with JSON). Although I'd prefer we use YAML to keep consistent.

What we need to do now is pull out the colours into a palette file. Then for each *.ttheme.js file, import that palette, change the colours.

I haven't worked out how we can do that with variables in the file though...

@hussani
Copy link
Collaborator

hussani commented Oct 7, 2013

Nice!

I'm not a Node.JS programmer, but will try help in this tool!

@jbrooksuk
Copy link
Owner Author

Okay, open an issue on it if you need any help.

@jbrooksuk
Copy link
Owner Author

All we need is a PLIST to YAML converter now ;)

@jbrooksuk
Copy link
Owner Author

I've converted the tmTheme files into YAML. There is also a palette file now which we can use as the default colour scheme, then modify them based on the generator.

@hussani
Copy link
Collaborator

hussani commented Oct 11, 2013

How do you generate a tmTheme from yaml?
I'm trying but have no response =/

@jbrooksuk
Copy link
Owner Author

I used an Xcode developer tool that converts to JSON.

plutil -convert json Oblivion.tmTheme -o Oblivion.json

Then I used an online tool for JSON to YAML.

@jbrooksuk
Copy link
Owner Author

Did you have any luck @hussani?

@hussani
Copy link
Collaborator

hussani commented Oct 14, 2013

plutil in Ubuntu don't have a convert parameter.
But, it isn't a big problem. The TTheme converts the converted yaml to plist?

@jbrooksuk
Copy link
Owner Author

Ah right, plutil on OSX does have that parameter, is there another version?

Yes, TTheme should be doing that. Is it not?

@hussani
Copy link
Collaborator

hussani commented Oct 14, 2013

plutil is a proprietary tool of Apple. I don't know a similar tool to linux.

I have this error when compile yaml to plist with Ttheme:
syntax error near 'token 'unexpected '('

The executed command is:
ttheme -o Oblivion-SodaDark.yml -c OblivionSodaDark.tmTheme

@jbrooksuk
Copy link
Owner Author

Can you send me a link to a Gist containing the YAML please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants