Darken This (UI Highlighting)
// Darkens the selected layer by adding an adjustment layer
// with a Levels effect to reduce brightness.
// Ensure a layer is selected before applying the effect.
if (app.project.activeItem.selectedLayers.length > 0) {
// Get the selected layer
var selectedLayer = app.project.activeItem.selectedLayers[0];
// Get the index of the selected layer
var layerIndex = selectedLayer.index;
// Create an adjustment layer
var adjustmentLayer = app.project.activeItem.layers.addSolid(
[1, 1, 1],
"Adjustment Layer",
app.project.activeItem.width,
app.project.activeItem.height,
1
);
adjustmentLayer.adjustmentLayer = true;
// Set the in and out points of the adjustment layer to match the selected layer
adjustmentLayer.inPoint = selectedLayer.inPoint;
adjustmentLayer.outPoint = selectedLayer.outPoint;
// Set the label color of the adjustment layer to Lavender
adjustmentLayer.label = 10;
// Add a Levels effect and set the output white to 130
var levelsEffect = adjustmentLayer.Effects.addProperty("ADBE Pro Levels2");
levelsEffect.property("Output White").setValue(130 / 255);
// Move the adjustment layer to the correct position in the layer stack
adjustmentLayer.moveBefore(app.project.activeItem.layer(layerIndex + 1));
} else {
alert("Please select a layer first.");
}
// Script created by Jack Vaughan (jackvaughan.com/tools)
How to use the script
Always check code before running it on your computer. Even basic scripts like this one. If you’re not a developer, ask an LLM like ChatGPT, Claude, or Gemini to verify it for you.
Option 1: Install to your AE Folder
Download and install the below .jsx file in your After Effects Script folder. You can then run it using the scripts menu, or by using a launcher like Quick Menu 3.
Option 2: Adapt the script yourself
Alternatively copy the code below and develop your own version. If you’re not a developer you can do this easily with an LLM like ChatGPT.
More about my Stack
Sorry, we haven't filled this category yet!