themerdev / themer

🎨 themer takes a set of colors and generates themes for your apps (editors, terminals, wallpapers, and more).
https://themer.dev
MIT License
5.43k stars 113 forks source link

Vim undefined variable #77

Closed Luke-zhang-04 closed 3 years ago

Luke-zhang-04 commented 3 years ago

Description

Usage of themer along with @themer/vim causes undefined variable errors

To reproduce

Steps to reproduce the behavior:

  1. Use themer template
  2. generate

Screenshots

image

Expected behavior

No errors

Environment information

CLI

Please fill out the following information if you are using the command-line interface. For the web UI, you can delete this section.

Additional context

Here's my config file

module.exports.colors = {
    dark: {
        accent0: "#FF4050",
        accent1: "#F28144",
        accent2: "#FFD24A",
        accent3: "#A4CC35",
        accent4: "#26C99E",
        accent5: "#66BFFF",
        accent6: "#CC78FA",
        accent7: "#F553BF",

        shade0: "#282629",
        shade1: "#474247",
        shade2: "#656066",
        shade3: "#847E85",
        shade4: "#A29DA3",
        shade5: "#C1BCC2",
        shade6: "#E0DCE0",
        shade7: "#FFFCFF",
    },
}

The problem is the if statement causing the variable to be scoped locally


  if &background == 'dark'

  let s:guishade0 = "#282629"
  let s:guishade1 = "#474247"
  let s:guishade2 = "#656066"

  . . .

  endif

I know the s: is supposed to scope the variable to the script, but for some reason, I get those errors. If I remove the if statements, themer works.

Luke-zhang-04 commented 3 years ago

Massive facepalm

mjswensen commented 3 years ago

Is it working for you now, @Luke-zhang-04 ? If so, what was the issue?

Luke-zhang-04 commented 3 years ago

Is it working for you now, @Luke-zhang-04 ? If so, what was the issue?

I didn't set my background to dark to the code under the if didn't execute :man_facepalming:

mjswensen commented 3 years ago

Ahh, I see 😁 I'm glad it's working now!