import numpy as np
import matplotlib.pyplot as plt
# INITIAL CONDITIONS
m = 550E03 # kg
r = 3.7 / 2 # m
l = 70 # m
I = m * ( (r ** 2) / 4 + (l ** 2) / 12 ) # kg * m^2
position = [0, 0] # m
velocity = [0, 0] # m/s
acceleration = [0, 0] # m/s^2
theta = np.pi / 2 # rad
F_g = [0, -53.935E06] # N
F_R = [80.905E06 * np.cos(theta), 80.905E06 * np.sin(theta)] # N
With this code, VS Code seems to change the color of the variable F_R
arbitrarily. I’ve noticed it does the same for any variable named with the format [Capital Letter]_[Capital Letter]
. Any particular idea why this might be the case, and/or how to change this? It is not dependent on VS Code’s Color Theme.
2
Answers
As per PEP-8:
VSCode considers
F_R
constant and that’s why the color is different. You can confirm if hoover with mouse over it.As a side note, with my setup of VSCode, all other variables/names are light-blue and
pylint
complains they don’t conform to naming convention for constants.The answer by buran already explains why the colors are different. Here’s a way to modify the color.
vscode syntax highlighting is related to the theme.
Theme: [Abyss]
Theme: [Dark High Contrast]
You can customize syntax highlighting in
settings.json
with the following configurationTheme: [Default Dark+]