Why is there a darkening of the solar disk towards the edge in the optical range, and, on the contrary

Why is there a darkening of the solar disk towards the edge in the optical range, and, on the contrary, an increase in brightness in the X-ray range?

At the edge of the Sun’s disk, the eye sees less deep, and, therefore, colder layers compared to the center of the disk. In general, this is perceived as a darkening of the disc towards the edge.
The brightness in X-rays is determined by the optical depth of the solar corona, where this radiation occurs. Near the edge of the disk, the optical thickness of the corona is greater than in the center, and therefore, the brightness will also be greater.

Remember: The process of learning a person lasts a lifetime. The value of the same knowledge for different people may be different, it is determined by their individual characteristics and needs. Therefore, knowledge is always needed at any age and position.