use of fill() function

the use of fill seems to apply to the background as well (inside a draw function) whereas the inlcuded notes implies that it applies to rect() and ellipse(). How do I specifically apply fill() to a rectangle?

function setup()
parameter(“Temperature”,-50,50)
parameter(“RelativeHumidity”,0,100)
displayMode(STANDARD)
end

function draw()
background(57, 66, 205, 255)
displayTemp=string.format(“%4.1f”,Temperature)
displayRH = string.format(“%3d”,RelativeHumidity)
fontSize(96)
stroke(215, 53, 53, 255)
strokeWidth(2)

rect(WIDTH/2,HEIGHT - 50,50,100)
text(displayTemp,WIDTH/2,HEIGHT - 50)
text(displayRH,WIDTH/2,HEIGHT - 200)

end

You can format the code using ~ three times before and after the code.

function setup() 
    
parameter("Temperature",-50,50) 
parameter("RelativeHumidity",0,100) 
displayMode(STANDARD) 

end

function draw() 
    background(57, 66, 205, 255) 
    displayTemp=string.format("%4.1f",Temperature) 
    displayRH = string.format("%3d",RelativeHumidity) 
    
    
    strokeWidth(2)
    --fill background for rect
    fill(44, 241, 45, 255)
    --set border color
    stroke(0, 255, 0, 255) 
    
    rect(WIDTH/2,HEIGHT - 50,50,100)
    
    fontSize(96) 
    fill(255)
    -- set color for text
    text(displayTemp,WIDTH/2,HEIGHT - 50)
    text(displayRH,WIDTH/2,HEIGHT - 200)
end

I didn’t get the question. The fill() is applying to the rect(). If you want the fill to only apply to the rect() then place it between a pushstyle() popstyle()

Thanks this is what I needed to know. You have helped perfectly despite your claim as to not understanding my question.