Hollywood "blows up spacecraft" with wonderful sound and visual effects. I know sound cannot travel in a vacuum but light can. Would there be any interesting "visual fireworks" in the vacuum of space. What affect would the amount of gravity have (microgravity of space or lower gravity of the moon)?
This is one of those things that Hollywood will almost always get wrong, because they want them to look like the audience expects them to look, and have absolutely no interest in teaching physics!
There is not too much data available (in public, anyhow) on what explosions in space really look like, so I will have to limit myself to what I think they should look like. (At least I do have an interest in teaching physics.)
Details about the amount of energy and matter involved in the explosion affect the appearance. A universal generality, true in space as on Earth, is that, other things being equal, a larger explosion (inevitably seen from a larger distance by any witnesses who survive to describe it) appears to happen more slowly than a smaller explosion seen from closer at hand. However, bear in mind that the actual energy release event of any actual explosion happens very quickly.
On Earth, the interaction with the surrounding matter, be it air, water, or whatever, means that the initial energy is very quickly, in a few milliseconds, spread out over a fairly large amount of matter, no matter what the nature of the explosive. This material, typically air, forms a luminous fireball that expands at the speed of sound in the air that has been heated by the explosion, which is faster than the speed of sound in ordinary cool air. The result is a shock wave at the surface of the fireball. As the fireball expands it compresses and heats the surrounding air, while losing energy by radiation and also because of the work it is doing on the outside air, all of which causes it to cool. Eventually it cools to the point where it is no longer luminous, the shock wave moves out ahead and makes the BANG! that we hear and that may knock down buildings, and a cloud of swirling debris, smoke, and maybe brownish nitrogen oxides are left behind.
In space, the first few milliseconds proceed as they would in air (say), but then the transfer of energy to the surrounding air never takes place. As a result the initial small, intensely hot fireball simply keeps expanding at very high speed, and the expanding gases and any fragments fly off in straight lines. The fireball cools by radiation at first, but as its density drops it becomes so transparent that radiation is suppressed. For a chemical high explosive, the expansion speed would be a few thousand feet per second. So for a moderate size explosive -- say 1 meter across -- the products will expand to 100 meters in probably less than 0.1 sec, meaning the density will have decreased by a factor of a million, and the visible explosion will effectively be over. Visually the effect would be of a very brief, brilliant flash in a region only a little bigger than the actual extent of the explosive material. Of course there would be no billowing swirling smoke, and any fragments would almost certainly be moving too fast to be visible. The effect would probably be something like that of a big flashbulb.
For a nuclear explosion, the fireball would radiate mainly in the x-ray and ultraviolet, which are not visible to the eye, although the visible part of the radiation would produce a blue-white flash. The expansion speed would be many hundreds or thousands of times faster than for a chemical explosion, so that the time scale would be less than a millisecond. All the material near the source would be vaporized, so there would be no fragments. If the explosion was truly in space, and not in a tenuous atmosphere, then viewed from a survivable distance the effect would probably be similar to, but even less spectacular than, a chemical explosion.
There is one account of a nuclear explosion in the public literature that I know, that of the 1 Megaton "Starfish" explosion in 1962 over Johnston Is. in the South Pacific. Because it was not really in space, but in the upper atmosphere a few hundred km high, it created a ghostly fireball hundreds of km in extent, much less brilliant than in air, but still "a fearsome sight" (according to Bernard J. O'Keefe, "Nuclear Hostages", 1983).
Regarding visual fireworks, I would expect none in vacuum, but as the Starfish example shows, even a small amount of matter could have a spectacular effect. For a nuclear explosion especially, spectacular fluorescence effects could occur due to the excitation of the upper atmosphere by ultraviolet and X rays. Also, the burst of high-energy charged particles from a nuclear explosion near the Earth can be caught in the Earth's magnetic field, and then channeled into the upper atmosphere, producing auroras that may be spectacular over large parts of the globe.
The effect of gravity should depend on the velocity of the ejecta compared to the escape velocity of the body in question. For a nuclear explosion near an airless body like the Moon (in the absence of a strong magnetic field), the material ejected would be moving so much faster than escape velocity that it would simply stream off in straight lines, with essentially no effect. For a chemical explosion, the velocity of the ejecta on the Moon would be comparable to but mostly less than lunar escape velocity, so that the fragments would typically follow elliptical ballistic trajectories that would bring them raining down all over the Moon, hundreds or thousands of km from the original explosion, for many minutes or even hours. If the explosion was well above the surface, some fragments might go into lunar orbit. A few might strike the Earth.