We can't generate electricity from darkness, because darkness is the absence of light.
Energy cannot be created or destroyed. It can only be converted from one form to another.
Plants absorb energy from light and convert it to the potential energy in chemical bonds.
They can continue transforming the absorbed energy even when light is no longer present.
Darkness is the absence of light.
Without light, there is no energy available to be transformed into electrical energy.